Build: Added separate eslint configs for TS and JS files

This commit is contained in:
Aria Minaei 2021-06-25 14:35:59 +02:00
parent ad6917b3d6
commit a6414deb3f

View file

@ -1,37 +1,8 @@
module.exports = { module.exports = {
root: true, root: true,
parser: '@typescript-eslint/parser', plugins: ['unused-imports'],
plugins: ['@typescript-eslint', 'unused-imports'],
parserOptions: {
project: ['./packages/**/tsconfig.json', './theatre/**/tsconfig.json'],
},
extends: [], extends: [],
rules: { rules: {
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/no-throw-literal': 'warn',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/ban-types': [
'error',
{
extendDefaults: true,
types: {
any: {
message:
"Don't use any. Use $FixMe or another alternative listed at defs.d.ts",
fixWith: '$FixMe',
},
'{}': false,
object: false,
},
},
],
'@typescript-eslint/no-unused-vars': 'off',
'unused-imports/no-unused-imports-ts': 'warn', 'unused-imports/no-unused-imports-ts': 'warn',
'no-restricted-imports': [ 'no-restricted-imports': [
'error', 'error',
@ -45,4 +16,35 @@ module.exports = {
}, },
], ],
}, },
ignorePatterns: ['*.d.ts'],
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
project: ['./packages/**/tsconfig.json', './theatre/**/tsconfig.json'],
},
rules: {
'@typescript-eslint/await-thenable': 'warn',
'@typescript-eslint/no-throw-literal': 'warn',
'@typescript-eslint/switch-exhaustiveness-check': 'error',
'@typescript-eslint/consistent-type-imports': [
'warn',
{
prefer: 'type-imports',
},
],
'@typescript-eslint/no-unused-vars': 'off',
},
},
{
files: ['*.mjs', '*.js'],
parser: 'espree',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
},
},
],
} }