Correct location of rules for eslint

This commit is contained in:
Eric Schultz 2020-10-22 14:35:35 -05:00 committed by Eric Schultz
parent 1a87c097ab
commit 093852b9a5

View file

@ -38,7 +38,51 @@ const tsBase = {
'plugin:@typescript-eslint/recommended',
"plugin:react-hooks/recommended",
],
rules: {
};
const tsSettings = _.cloneDeep(tsBase);
tsSettings['files'] = ['**/*.ts'];
const tsxSettings = _.cloneDeep(tsBase);
tsxSettings['files'] = ['**/*.tsx'];
tsxSettings['plugins'] = [...tsxSpec['plugins'], "react"];
tsxSettings['extends'] = [...tsxSpec['extends'], "plugin:react/recommended"];
module.exports = {
root: true,
overrides: [
{
"files": ['*.js', 'config/webpack/**/*.js'],
extends: [
'eslint:recommended',
'plugin:node/recommended',
],
},
tsSpec,
tsxSpec,
tsSettings,
tsxSettings,
{
"files": ['*.stories.ts', '*.stories.tsx'],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": ["off"],
},
},
],
"rules": {
"linebreak-style": [
"error",
"unix",
],
"semi": [
"error",
"always",
],
"no-trailing-spaces": ["error"],
"indent": ["error", "tab", { "SwitchCase": 1 }], // we use tabs for accessibility
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/no-unused-vars": ['error', { "args": "all", "argsIgnorePattern": "^_" }],
'@typescript-eslint/member-ordering': ['error',
{
// this is the default from @typescript-eslint itself
@ -129,52 +173,6 @@ const tsBase = {
},
],
},
};
const tsSettings = _.cloneDeep(tsBase);
tsSettings['files'] = ['**/*.ts'];
const tsxSettings = _.cloneDeep(tsBase);
tsxSettings['files'] = ['**/*.tsx'];
tsxSettings['plugins'] = [...tsxSpec['plugins'], "react"];
tsxSettings['extends'] = [...tsxSpec['extends'], "plugin:react/recommended"];
module.exports = {
root: true,
overrides: [
{
"files": ['*.js', 'config/webpack/**/*.js'],
extends: [
'eslint:recommended',
'plugin:node/recommended',
],
},
tsSpec,
tsxSpec,
tsSettings,
tsxSettings,
{
"files": ['*.stories.ts', '*.stories.tsx'],
"rules": {
"@typescript-eslint/explicit-module-boundary-types": ["off"],
},
},
],
"rules": {
"linebreak-style": [
"error",
"unix",
],
"semi": [
"error",
"always",
],
"no-trailing-spaces": ["error"],
"indent": ["error", "tab", { "SwitchCase": 1 }], // we use tabs for accessibility
"comma-dangle": "off",
"@typescript-eslint/comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/no-unused-vars": ['error', { "args": "all", "argsIgnorePattern": "^_" }],
},
"settings": {
"react": {
"version": "detect",