chore(lint): Updating to latest eslint with typescript and enabling some rules that we can. Also fixing issues with the project after update

This commit is contained in:
blam
2021-01-22 15:01:29 +01:00
parent ce526adb19
commit 5b9bcce28f
15 changed files with 471 additions and 461 deletions
+10 -3
View File
@@ -34,12 +34,12 @@ module.exports = {
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
lib: ['DOM', 'DOM.Iterable', 'ScriptHost', 'ES2020', 'ESNext.Promise'],
},
ignorePatterns: ['.eslintrc.js', '**/dist/**', '**/dist-types/**'],
rules: {
// TODO(Rugvip): We need to bump @typescript-eslint to v4 to enable these
'@typescript-eslint/no-shadow': 0,
'@typescript-eslint/no-redeclare': 0,
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-redeclare': 'off',
'no-console': 0, // Permitted in console programs
'new-cap': ['error', { capIsNew: false }], // Because Express constructs things e.g. like 'const r = express.Router()'
@@ -79,6 +79,13 @@ module.exports = {
],
},
overrides: [
{
files: ['**/*.ts?(x)'],
rules: {
'@typescript-eslint/no-unused-vars': 'off',
'no-undef': 'off',
},
},
{
files: ['*.test.*', 'src/setupTests.*', 'dev/**'],
rules: {
+10 -5
View File
@@ -26,13 +26,17 @@ module.exports = {
'plugin:monorepo/recommended',
],
parser: '@typescript-eslint/parser',
plugins: ['import'],
plugins: ['import', 'react'],
env: {
jest: true,
},
parserOptions: {
ecmaVersion: 2018,
ecmaFeatures: {
jsx: true,
},
sourceType: 'module',
lib: ['DOM', 'DOM.Iterable', 'ScriptHost', 'ES2020', 'ESNext.Promise'],
},
settings: {
react: {
@@ -41,10 +45,9 @@ module.exports = {
},
ignorePatterns: ['.eslintrc.js', '**/dist/**', '**/dist-types/**'],
rules: {
// TODO(Rugvip): We need to bump @typescript-eslint to v4 to enable these
'@typescript-eslint/no-shadow': 0,
'@typescript-eslint/no-redeclare': 0,
'@typescript-eslint/no-shadow': 'off',
'@typescript-eslint/no-redeclare': 'off',
'no-undef': 'off',
'import/newline-after-import': 'error',
'import/no-duplicates': 'warn',
'import/no-extraneous-dependencies': [
@@ -90,6 +93,8 @@ module.exports = {
rules: {
// Default to not enforcing prop-types in typescript
'react/prop-types': 0,
'@typescript-eslint/no-unused-vars': 'off',
'no-undef': 'off',
},
},
{