diff --git a/.eslintrc.js b/.eslintrc.js index fa53e6c..b364a88 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,11 +1,13 @@ module.exports = { - extends: ['./react'], + extends: [ './react' ], env: { browser: true, node: true, - es2021: true + es2021: true, }, parserOptions: { project: './tsconfig.json', + warnOnUnsupportedTypeScriptVersion: false, }, + reportUnusedDisableDirectives: true, }; diff --git a/base.js b/base.js index 448341a..fc01697 100644 --- a/base.js +++ b/base.js @@ -1,17 +1,17 @@ module.exports = { - plugins: ['import'], + plugins: [ 'import' ], rules: { // -- Generic rules - 'import/no-extraneous-dependencies': ['error', { devDependencies: true }], + 'import/no-extraneous-dependencies': [ 'error', { devDependencies: true } ], 'import/no-unresolved': 'off', 'newline-before-return': 'error', - 'no-console': ['warn'], + 'no-console': [ 'warn' ], 'no-restricted-syntax': 'off', 'no-shadow': 'off', '@typescript-eslint/no-shadow': 'off', - 'no-return-assign': ['error', 'except-parens'], - 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], + 'no-return-assign': [ 'error', 'except-parens' ], + 'no-plusplus': [ 'error', { allowForLoopAfterthoughts: true } ], '@typescript-eslint/return-await': 'off', // -- No default exports @@ -37,9 +37,9 @@ module.exports = { { before: false, after: true, overrides: { arrow: { before: true, after: true } } }, ], '@typescript-eslint/member-delimiter-style': 'error', - 'array-bracket-spacing': ['error', 'always'], - 'comma-dangle': ['error', 'always-multiline'], - '@typescript-eslint/comma-dangle': ['error', 'always-multiline'], + 'array-bracket-spacing': [ 'error', 'always' ], + 'comma-dangle': [ 'error', 'always-multiline' ], + '@typescript-eslint/comma-dangle': [ 'error', 'always-multiline' ], 'max-len': [ 'error', { @@ -50,9 +50,9 @@ module.exports = { ignoreTemplateLiterals: true, }, ], - 'no-multiple-empty-lines': ['error', { max: 1, maxEOF: 1, maxBOF: 0 }], - '@typescript-eslint/brace-style': ['error', '1tbs', { allowSingleLine: false }], - curly: ['error', 'all'], + 'no-multiple-empty-lines': [ 'error', { max: 1, maxEOF: 1, maxBOF: 0 } ], + '@typescript-eslint/brace-style': [ 'error', '1tbs', { allowSingleLine: false } ], + curly: [ 'error', 'all' ], 'key-spacing': 'error', // -- Typescript @@ -71,7 +71,7 @@ module.exports = { overrides: [ { - files: ['src/**/*.spec.ts', 'src/**/*.spec.tsx'], + files: [ 'src/**/*.spec.ts', 'src/**/*.spec.tsx' ], rules: { 'max-len': 'off', }, diff --git a/index.js b/index.js index 760d578..b478f97 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ module.exports = { extends: [ 'eslint-config-airbnb-typescript/base', - './base.js' + './base.js', ], -} \ No newline at end of file +}; \ No newline at end of file diff --git a/package.json b/package.json index 72daadb..a91db40 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "url": "https://github.com/loveholidays/eslint-config-loveholidays/issues" }, "scripts": { - "lint": "eslint --ext .ts,.tsx ./test", + "lint": "eslint --cache .", + "lint:fix": "eslint --cache --fix .", "lint:info": "eslint --print-config .eslintrc.js" }, "dependencies": { diff --git a/react.js b/react.js index a3236bb..8413bba 100644 --- a/react.js +++ b/react.js @@ -5,18 +5,18 @@ module.exports = { 'plugin:react-hooks/recommended', './base.js', ], - plugins: ['@studysync/persnickety'], + plugins: [ '@studysync/persnickety' ], settings: { react: { version: '16.2', }, }, rules: { - 'react/jsx-first-prop-new-line': ['error', 'multiline'], - 'react/jsx-max-props-per-line': ['error', { maximum: 1, when: 'always' }], - 'react/jsx-indent': ['error', 2, { checkAttributes: true, indentLogicalExpressions: true }], - 'react/jsx-curly-spacing': ['error', 'never'], - 'react/jsx-fragments': ['error', 'element'], + 'react/jsx-first-prop-new-line': [ 'error', 'multiline' ], + 'react/jsx-max-props-per-line': [ 'error', { maximum: 1, when: 'always' } ], + 'react/jsx-indent': [ 'error', 2, { checkAttributes: true, indentLogicalExpressions: true } ], + 'react/jsx-curly-spacing': [ 'error', 'never' ], + 'react/jsx-fragments': [ 'error', 'element' ], 'react/jsx-key': 'error', 'react/jsx-one-expression-per-line': 'off', 'react/jsx-props-no-spreading': 'off', diff --git a/tsconfig.json b/tsconfig.json index 76cd6fd..9069aba 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,30 +1,20 @@ { + "include": [".*.js", "**/*.js", "**/*.ts", "**/*.tsx"], + "exclude": ["node_modules"], "compilerOptions": { - "jsx": "react", "module": "esnext", "target": "es2019", "moduleResolution": "node", - "strict": true, - "noImplicitReturns": true, - "noUnusedLocals": true, - "sourceMap": true, - "declaration": true, - "declarationDir": "dist/types", - "esModuleInterop": true, - "skipLibCheck": true, - "baseUrl": "./test", + + "jsx": "react", "allowJs": true, + + "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "outDir":"dist", - }, - "typeRoots": [ - "node_modules/@types", - ], - "include": [ - "test/**/*.ts", - "test/**/*.tsx", - ], - "exclude": [ - "node_modules", - ] + "skipLibCheck": true, + + "strict": true, + "noImplicitReturns": true, + "noUnusedLocals": true + } }