Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: make eslint work with vscode * chore: add jsx,tsx
- Loading branch information
Showing
18 changed files
with
180 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,53 @@ | ||
const typescriptEslintEslintPlugin = require('@typescript-eslint/eslint-plugin'); | ||
const jsRules = { | ||
'object-curly-spacing': [2, 'always'], | ||
'no-empty-function': 0, | ||
'valid-jsdoc': 0, | ||
'react/sort-comp': 0, // does not seem work as expected with typescript | ||
'mocha/no-skipped-tests': 1, | ||
'mocha/no-exclusive-tests': 2, | ||
'semi': [2, 'always'], | ||
'no-console': [1, { allow: ['warn', 'error', 'info'] }], | ||
'no-shadow': 0, | ||
'no-use-before-define': 0, | ||
'no-cond-assign': [2, 'except-parens'] | ||
} | ||
|
||
// ovrerrides do not work with extends | ||
const ruleOverridesForJs = Object.keys(typescriptEslintEslintPlugin.rules).reduce( | ||
(overrides, rule) => ({ ...overrides, [`@typescript-eslint/${rule}`]: 0 }), {} | ||
); | ||
const tsRules = { | ||
'@typescript-eslint/no-empty-function': 0, | ||
'@typescript-eslint/no-use-before-define': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'@typescript-eslint/no-var-requires': 0, // seems necessary to import less files | ||
'@typescript-eslint/no-unused-vars': 2, | ||
'@typescript-eslint/no-floating-promises': 2, | ||
'@typescript-eslint/await-thenable': 2, | ||
'@typescript-eslint/require-await': 2, | ||
'@typescript-eslint/explicit-module-boundary-types': 0, | ||
'@typescript-eslint/ban-types': 0, | ||
'semi': 0, | ||
'@typescript-eslint/semi': [2, 'always'] | ||
}; | ||
|
||
module.exports = { | ||
plugins: ['mocha'], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: './tsconfig.lint.json' | ||
}, | ||
extends: [ | ||
'eslint-config-mongodb-js/react', | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
rules: { | ||
'object-curly-spacing': [2, 'always'], | ||
'no-empty-function': 0, | ||
'valid-jsdoc': 0, | ||
'react/sort-comp': 0, // does not seem work as expected with typescript | ||
'@typescript-eslint/no-empty-function': 0, | ||
'@typescript-eslint/no-use-before-define': 0, | ||
'@typescript-eslint/no-explicit-any': 0, | ||
'@typescript-eslint/no-var-requires': 0, // seems necessary to import less files | ||
'@typescript-eslint/no-unused-vars': 2, | ||
'@typescript-eslint/no-floating-promises': 2, | ||
'@typescript-eslint/await-thenable': 2, | ||
'@typescript-eslint/require-await': 2, | ||
'@typescript-eslint/explicit-module-boundary-types': 0, | ||
'@typescript-eslint/ban-types': 0, | ||
'mocha/no-skipped-tests': 1, | ||
'mocha/no-exclusive-tests': 2, | ||
'semi': 0, | ||
'@typescript-eslint/semi': [2, 'always'], | ||
'no-console': [1, { allow: ['warn', 'error', 'info'] }], | ||
'no-shadow': 0, | ||
'no-use-before-define': 0, | ||
'no-cond-assign': [2, 'except-parens'] | ||
}, | ||
overrides: [{ | ||
files: ['**/*.js'], | ||
files: ['**/*.js', '**/*.jsx'], | ||
extends: [ | ||
'eslint-config-mongodb-js/react' | ||
], | ||
rules: { | ||
...jsRules | ||
} | ||
}, | ||
{ | ||
files: ['**/*.ts', '**/*.tsx'], | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'eslint-config-mongodb-js/react', | ||
'plugin:@typescript-eslint/recommended' | ||
], | ||
rules: { | ||
...ruleOverridesForJs, | ||
semi: [2, 'always'] | ||
...jsRules, | ||
...tsRules | ||
} | ||
}] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
module.exports = require('../../config/eslintrc.base'); | ||
module.exports = { | ||
...require('../../config/eslintrc.base'), | ||
root: true, | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: './tsconfig.lint.json' | ||
} | ||
}; |