Migrate from deprecated TSLint to ESLint with Airbnb config (#966)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com> Co-authored-by: Thomas Nordquist <thomasnordquist@users.noreply.github.com>
This commit is contained in:
8
.eslintignore
Normal file
8
.eslintignore
Normal file
@@ -0,0 +1,8 @@
|
||||
node_modules
|
||||
build
|
||||
dist
|
||||
app/build
|
||||
*.js
|
||||
!scripts/*.js
|
||||
!*.config.js
|
||||
!*.config.mjs
|
||||
315
.eslintrc.json
315
.eslintrc.json
@@ -1,17 +1,318 @@
|
||||
{
|
||||
"root": true,
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"globals": {
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module",
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
}
|
||||
},
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:import/typescript"
|
||||
],
|
||||
"plugins": [
|
||||
"@typescript-eslint",
|
||||
"import"
|
||||
],
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"typescript": {
|
||||
"alwaysTryTypes": true
|
||||
},
|
||||
"node": {
|
||||
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"semi": "off",
|
||||
"max-len": "warn",
|
||||
"@typescript-eslint/explicit-member-accessibility": "warn",
|
||||
"no-else-return": "warn",
|
||||
"indent": "off",
|
||||
"@typescript-eslint/indent": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"@typescript-eslint/naming-convention": "warn",
|
||||
"@typescript-eslint/comma-dangle": "warn",
|
||||
"comma-dangle": "off",
|
||||
"arrow-parens": "warn",
|
||||
"import/no-extraneous-dependencies": ["warn", {
|
||||
"devDependencies": ["**/*.spec.ts", "**/*.spec.tsx", "**/__tests__/**", "scripts/**", "src/spec/**"],
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": false
|
||||
}],
|
||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
||||
"@typescript-eslint/no-unused-expressions": ["warn", {
|
||||
"allowShortCircuit": true,
|
||||
"allowTernary": true
|
||||
}],
|
||||
"object-shorthand": "warn",
|
||||
"prefer-template": "warn",
|
||||
"no-plusplus": "warn",
|
||||
"class-methods-use-this": "warn",
|
||||
"consistent-return": "warn",
|
||||
"@typescript-eslint/lines-between-class-members": "warn",
|
||||
"import/extensions": "warn",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/no-shadow": "warn",
|
||||
"no-use-before-define": "off",
|
||||
"@typescript-eslint/no-use-before-define": "warn",
|
||||
"no-unused-vars": "off",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
|
||||
"import/no-cycle": "warn",
|
||||
"import/no-relative-packages": "warn",
|
||||
"operator-linebreak": "warn",
|
||||
"@typescript-eslint/no-explicit-any": "warn",
|
||||
"prefer-destructuring": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"import/order": "warn",
|
||||
"object-curly-newline": "warn",
|
||||
"import/no-named-default": "warn",
|
||||
"no-console": "warn",
|
||||
"func-names": "warn",
|
||||
"no-await-in-loop": "warn",
|
||||
"no-restricted-syntax": "warn",
|
||||
"no-continue": "warn",
|
||||
"no-promise-executor-return": "warn",
|
||||
"no-eval": "error",
|
||||
"@typescript-eslint/default-param-last": "warn",
|
||||
"radix": "warn",
|
||||
"no-param-reassign": "warn",
|
||||
"no-underscore-dangle": "warn",
|
||||
"no-restricted-globals": "warn",
|
||||
"@typescript-eslint/no-useless-constructor": "warn",
|
||||
"@typescript-eslint/ban-types": "warn",
|
||||
"global-require": "warn",
|
||||
"@typescript-eslint/no-var-requires": "warn",
|
||||
"eqeqeq": ["warn", "always", {"null": "ignore"}],
|
||||
"no-var": "warn",
|
||||
"prefer-const": "warn",
|
||||
"no-unused-expressions": "off",
|
||||
"curly": "warn",
|
||||
"no-duplicate-imports": "warn",
|
||||
"react-hooks/rules-of-hooks": "warn",
|
||||
"@typescript-eslint/prefer-as-const": "warn",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"react/jsx-boolean-value": "warn",
|
||||
"react/jsx-one-expression-per-line": "warn",
|
||||
"react/function-component-definition": "warn",
|
||||
"react/no-unescaped-entities": "warn",
|
||||
"no-trailing-spaces": "warn",
|
||||
"padded-blocks": "warn",
|
||||
"brace-style": "off",
|
||||
"@typescript-eslint/brace-style": "warn",
|
||||
"object-curly-spacing": "warn",
|
||||
"space-before-function-paren": "off",
|
||||
"@typescript-eslint/space-before-function-paren": "warn",
|
||||
"keyword-spacing": "warn",
|
||||
"space-infix-ops": "off",
|
||||
"@typescript-eslint/space-infix-ops": "warn",
|
||||
"comma-spacing": "off",
|
||||
"@typescript-eslint/comma-spacing": "warn",
|
||||
"quotes": "off",
|
||||
"@typescript-eslint/quotes": "warn",
|
||||
"linebreak-style": "warn"
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["src/**/*.ts", "scripts/**/*.ts", "events/**/*.ts"],
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"airbnb-typescript/base"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"semi": "off",
|
||||
"max-len": "warn",
|
||||
"@typescript-eslint/indent": "warn",
|
||||
"@typescript-eslint/no-throw-literal": "warn",
|
||||
"arrow-parens": "warn",
|
||||
"@typescript-eslint/comma-dangle": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"@typescript-eslint/no-use-before-define": "warn",
|
||||
"object-curly-newline": "warn",
|
||||
"no-trailing-spaces": "warn",
|
||||
"operator-linebreak": "warn",
|
||||
"no-await-in-loop": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"no-promise-executor-return": "warn",
|
||||
"import/no-cycle": "warn",
|
||||
"no-restricted-globals": "warn",
|
||||
"import/no-extraneous-dependencies": ["warn", {
|
||||
"devDependencies": ["**/*.spec.ts", "**/*.spec.tsx", "**/__tests__/**", "scripts/**", "src/spec/**"],
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": false
|
||||
}],
|
||||
"prefer-template": "warn",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"import/no-relative-packages": "warn",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["app/**/*.ts", "app/**/*.tsx"],
|
||||
"parserOptions": {
|
||||
"project": "./app/tsconfig.json"
|
||||
},
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"airbnb-typescript/base"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"semi": "off",
|
||||
"max-len": "warn",
|
||||
"@typescript-eslint/indent": "warn",
|
||||
"@typescript-eslint/no-throw-literal": "warn",
|
||||
"arrow-parens": "warn",
|
||||
"@typescript-eslint/comma-dangle": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"@typescript-eslint/no-use-before-define": "warn",
|
||||
"object-curly-newline": "warn",
|
||||
"no-trailing-spaces": "warn",
|
||||
"operator-linebreak": "warn",
|
||||
"no-await-in-loop": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"no-promise-executor-return": "warn",
|
||||
"import/no-cycle": "warn",
|
||||
"no-restricted-globals": "warn",
|
||||
"import/no-extraneous-dependencies": ["warn", {
|
||||
"devDependencies": ["**/*.spec.ts", "**/*.spec.tsx", "**/__tests__/**", "scripts/**", "src/spec/**"],
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": false
|
||||
}],
|
||||
"prefer-template": "warn",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"import/no-relative-packages": "warn",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["app/**/*.tsx"],
|
||||
"parserOptions": {
|
||||
"project": "./app/tsconfig.json"
|
||||
},
|
||||
"extends": [
|
||||
"airbnb",
|
||||
"airbnb-typescript",
|
||||
"plugin:react/recommended",
|
||||
"plugin:react-hooks/recommended"
|
||||
],
|
||||
"plugins": [
|
||||
"react",
|
||||
"react-hooks",
|
||||
"jsx-a11y"
|
||||
],
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"semi": "off",
|
||||
"max-len": "off",
|
||||
"@typescript-eslint/indent": "off",
|
||||
"@typescript-eslint/no-throw-literal": "warn",
|
||||
"react/jsx-filename-extension": ["error", { "extensions": [".tsx"] }],
|
||||
"react/prop-types": "off",
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"react/jsx-props-no-spreading": "warn",
|
||||
"jsx-a11y/click-events-have-key-events": "warn",
|
||||
"jsx-a11y/no-static-element-interactions": "warn",
|
||||
"react/destructuring-assignment": "warn",
|
||||
"react/no-access-state-in-setstate": "warn",
|
||||
"react/sort-comp": "warn",
|
||||
"react/no-unused-state": "warn",
|
||||
"react/state-in-constructor": "warn",
|
||||
"react/static-property-placement": "warn",
|
||||
"react/no-array-index-key": "warn",
|
||||
"react/display-name": "warn",
|
||||
"react-compiler/react-compiler": "off",
|
||||
"react/require-default-props": "warn",
|
||||
"react/jsx-no-bind": "warn",
|
||||
"arrow-parens": "warn",
|
||||
"@typescript-eslint/comma-dangle": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"@typescript-eslint/no-use-before-define": "warn",
|
||||
"object-curly-newline": "warn",
|
||||
"no-trailing-spaces": "warn",
|
||||
"operator-linebreak": "warn",
|
||||
"no-await-in-loop": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"no-promise-executor-return": "warn",
|
||||
"import/no-cycle": "warn",
|
||||
"no-restricted-globals": "warn",
|
||||
"import/no-extraneous-dependencies": ["warn", {
|
||||
"devDependencies": ["**/*.spec.ts", "**/*.spec.tsx", "**/__tests__/**", "scripts/**", "src/spec/**"],
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": false
|
||||
}],
|
||||
"prefer-template": "warn",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"import/no-relative-packages": "warn",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }],
|
||||
"react/jsx-boolean-value": "warn",
|
||||
"react/jsx-one-expression-per-line": "warn"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["backend/**/*.ts"],
|
||||
"parserOptions": {
|
||||
"project": "./backend/tsconfig.json"
|
||||
},
|
||||
"extends": [
|
||||
"airbnb-base",
|
||||
"airbnb-typescript/base"
|
||||
],
|
||||
"rules": {
|
||||
"@typescript-eslint/semi": ["error", "never"],
|
||||
"semi": "off",
|
||||
"max-len": "warn",
|
||||
"@typescript-eslint/indent": "warn",
|
||||
"@typescript-eslint/no-throw-literal": "warn",
|
||||
"arrow-parens": "warn",
|
||||
"@typescript-eslint/comma-dangle": "warn",
|
||||
"arrow-body-style": "warn",
|
||||
"@typescript-eslint/no-use-before-define": "warn",
|
||||
"object-curly-newline": "warn",
|
||||
"no-trailing-spaces": "warn",
|
||||
"operator-linebreak": "warn",
|
||||
"no-await-in-loop": "warn",
|
||||
"import/prefer-default-export": "warn",
|
||||
"no-promise-executor-return": "warn",
|
||||
"import/no-cycle": "warn",
|
||||
"no-restricted-globals": "warn",
|
||||
"import/no-extraneous-dependencies": ["warn", {
|
||||
"devDependencies": ["**/*.spec.ts", "**/*.spec.tsx", "**/__tests__/**", "scripts/**", "src/spec/**"],
|
||||
"optionalDependencies": true,
|
||||
"peerDependencies": false
|
||||
}],
|
||||
"prefer-template": "warn",
|
||||
"prefer-arrow-callback": "warn",
|
||||
"import/no-relative-packages": "warn",
|
||||
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": ["*.spec.ts", "*.spec.tsx", "**/__tests__/**"],
|
||||
"rules": {
|
||||
"@typescript-eslint/no-unused-expressions": "off",
|
||||
"import/no-extraneous-dependencies": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -20,6 +20,8 @@ jobs:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Install Packages
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Lint
|
||||
run: yarn lint:eslint
|
||||
- name: Build
|
||||
run: yarn build
|
||||
- name: Test
|
||||
|
||||
22
package.json
22
package.json
@@ -29,12 +29,12 @@
|
||||
"dev:server": "npm-run-all --parallel dev:server:*",
|
||||
"dev:server:app": "(cd app && npx webpack-dev-server --config webpack.browser.config.mjs --mode development --progress)",
|
||||
"dev:server:backend": "tsc && node dist/src/server.js",
|
||||
"lint": "npm-run-all --parallel lint:prettier lint:tslint lint:spellcheck",
|
||||
"lint:fix": "npm-run-all lint:tslint:fix lint:prettier:fix",
|
||||
"lint": "npm-run-all --parallel lint:prettier lint:eslint lint:spellcheck",
|
||||
"lint:fix": "npm-run-all lint:eslint:fix lint:prettier:fix",
|
||||
"lint:prettier": "prettier --check \"**/*.ts{x,}\"",
|
||||
"lint:prettier:fix": "prettier --write \"**/*.ts{x,}\"",
|
||||
"lint:tslint": "tslint -p ./",
|
||||
"lint:tslint:fix": "tslint -p ./ --fix",
|
||||
"lint:eslint": "eslint --ext .ts,.tsx .",
|
||||
"lint:eslint:fix": "eslint --ext .ts,.tsx . --fix",
|
||||
"lint:spellcheck": "cspell -e ./build -e \"node_modules\" \"**/*.ts{x,}\"",
|
||||
"build": "tsc && (cd app && yarn run build)",
|
||||
"build:server": "npx tsc && (cd app && npx webpack --config webpack.browser.config.mjs --mode production)",
|
||||
@@ -116,11 +116,21 @@
|
||||
"@types/sha1": "^1.1.1",
|
||||
"@types/socket.io": "^3.0.2",
|
||||
"@types/uuid": "^8.3.4",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"builder-util-runtime": "^9.3.1",
|
||||
"chai": "^4.5.0",
|
||||
"cspell": "^8.19.4",
|
||||
"electron": "39.2.7",
|
||||
"electron-builder": "^26.4.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-typescript": "^18.0.0",
|
||||
"eslint-import-resolver-typescript": "^4.4.4",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.10.2",
|
||||
"eslint-plugin-react": "^7.37.5",
|
||||
"eslint-plugin-react-hooks": "^7.0.1",
|
||||
"mocha": "^10.8.2",
|
||||
"mustache": "^4.2.0",
|
||||
"npm-run-all": "^4.1.5",
|
||||
@@ -132,10 +142,6 @@
|
||||
"semantic-release-export-data": "^1.2.0",
|
||||
"source-map-support": "^0.5.9",
|
||||
"sparkplug-client": "^3.2.4",
|
||||
"tslint": "^6.1.3",
|
||||
"tslint-config-airbnb": "^5.11.2",
|
||||
"tslint-react": "^5.0.0",
|
||||
"tslint-react-recommended": "^1.0.15",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
|
||||
32
tslint.json
32
tslint.json
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint-config-airbnb", "tslint-react", "tslint-react-recommended"],
|
||||
"rules": {
|
||||
"semicolon": [true, "never"],
|
||||
"max-line-length": [true, 200],
|
||||
"member-access": true,
|
||||
"no-else-after-return": false,
|
||||
"align": false,
|
||||
"jsx-no-lambda": false,
|
||||
"indent": [true, "spaces", 2],
|
||||
"import-name": false,
|
||||
"no-submodule-imports": false,
|
||||
"array-type": [true, "generic"],
|
||||
"prefer-array-literal": false,
|
||||
"function-name": false,
|
||||
"ter-arrow-parens": [true, "as-needed"],
|
||||
"variable-name": [true, "ban-keywords", "check-format", "allow-pascal-case"],
|
||||
"no-implicit-dependencies": [true, "dev", "optional"],
|
||||
"trailing-comma": [
|
||||
true,
|
||||
{
|
||||
"multiline": {
|
||||
"objects": "always",
|
||||
"arrays": "always",
|
||||
"functions": "never",
|
||||
"typeLiterals": "ignore"
|
||||
},
|
||||
"esSpecCompliant": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user