Skip to content

Commit 6e96bfa

Browse files
authored
chore(code-lint): Add lint to check (VSCODE-215) (#230)
1 parent 7eede49 commit 6e96bfa

38 files changed

+1306
-1523
lines changed

.eslintignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
node_modules/
1+
node_modules
2+
out
3+
dist
4+
scripts

.eslintrc

Lines changed: 0 additions & 62 deletions
This file was deleted.

.eslintrc.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin');
2+
3+
// Overrides do not work with extends.
4+
const ruleOverridesForJs = Object.keys(typescriptEslintEslintPlugin.rules).reduce(
5+
(overrides, rule) => ({ ...overrides, [`@typescript-eslint/${rule}`]: 0 }), {}
6+
);
7+
8+
module.exports = {
9+
plugins: ['mocha', '@typescript-eslint'],
10+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser.
11+
parserOptions: {
12+
ecmaVersion: 2018,
13+
sourceType: 'module',
14+
project: [
15+
'./tsconfig.json'
16+
]
17+
},
18+
extends: [
19+
'eslint-config-mongodb-js/react',
20+
'plugin:@typescript-eslint/eslint-recommended',
21+
'plugin:@typescript-eslint/recommended',
22+
'plugin:@typescript-eslint/recommended-requiring-type-checking'
23+
],
24+
rules: {
25+
'chai-friendly/no-unused-expressions': 0,
26+
'object-curly-spacing': [2, 'always'],
27+
'no-empty-function': 0,
28+
'valid-jsdoc': 0,
29+
'react/sort-comp': 0, // Does not seem work as expected with typescript.
30+
'@typescript-eslint/no-empty-function': 0,
31+
'@typescript-eslint/no-use-before-define': 0,
32+
'@typescript-eslint/no-explicit-any': 0,
33+
'@typescript-eslint/no-var-requires': 0,
34+
'@typescript-eslint/no-unused-vars': 2,
35+
'@typescript-eslint/explicit-module-boundary-types': 0,
36+
'@typescript-eslint/ban-types': 0,
37+
'mocha/no-skipped-tests': 1,
38+
'mocha/no-exclusive-tests': 2,
39+
'semi': 0,
40+
'@typescript-eslint/semi': [2, 'always'],
41+
'no-console': [1, { allow: ['warn', 'error', 'info'] }],
42+
'no-shadow': 0,
43+
'no-use-before-define': 0,
44+
'no-cond-assign': [2, 'except-parens'],
45+
'space-before-function-paren': 0,
46+
'@typescript-eslint/no-floating-promises': 0,
47+
48+
'restrict-template-expressions': 0,
49+
'@typescript-eslint/restrict-template-expressions': 0,
50+
51+
// VV These rules we'd like to turn off one day so they error.
52+
'@typescript-eslint/no-unsafe-assignment': 'warn',
53+
'@typescript-eslint/no-unsafe-member-access': 'warn',
54+
'@typescript-eslint/no-unsafe-call': 'warn',
55+
'@typescript-eslint/no-unsafe-return': 'warn'
56+
},
57+
overrides: [{
58+
files: ['**/*.js'],
59+
rules: {
60+
...ruleOverridesForJs,
61+
semi: [2, 'always']
62+
}
63+
}]
64+
};

0 commit comments

Comments
 (0)