Skip to content

Commit

Permalink
Update to ESLint 9.11 and typescript-eslint 8.11 (#82)
Browse files Browse the repository at this point in the history
Co-authored-by: Arun George <[email protected]>
  • Loading branch information
wgoehrig and aruniverse authored Oct 23, 2024
1 parent 779c4a1 commit aa162bb
Show file tree
Hide file tree
Showing 19 changed files with 2,487 additions and 1,920 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.1
version: 9.12.0

- name: Install dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.1
version: 9.12.0

- name: Install dependencies
run: pnpm install --frozen-lockfile=true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8.15.1
version: 9.12.0

- name: Install dependencies
run: pnpm install --frozen-lockfile=true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ npm i @itwin/eslint-plugin --save-dev
In order for VSCode to use the config file as it is set up, add the following setting to the the VSCode settings (in `.vscode/settings.json`):

```json
"eslint.experimental.useFlatConfig": true,
"eslint.useFlatConfig": true,
```

## Usage
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "major",
"comment": "Updated to support ESLint v9 and typescript-eslint v8.11",
"packageName": "@itwin/eslint-plugin",
"email": "[email protected]",
"dependentChangeType": "patch"
}
109 changes: 4 additions & 105 deletions dist/configs/itwinjs-recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ module.exports =
"@typescript-eslint": typescriptEslintPlugin,
"import": require("eslint-plugin-import"),
"prefer-arrow": require("eslint-plugin-prefer-arrow"),
"deprecation": require("eslint-plugin-deprecation"),
"@itwin": require("../plugin")
},
rules: {
Expand Down Expand Up @@ -43,24 +42,7 @@ module.exports =
}
],
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/indent": [
"error",
2
],
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": [
"error",
{
"multiline": {
"delimiter": "semi",
"requireLast": true
},
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/naming-convention": [
"error",
Expand Down Expand Up @@ -141,7 +123,6 @@ module.exports =
}
],
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-implied-eval": "off",
Expand Down Expand Up @@ -170,6 +151,7 @@ module.exports =
}
],
"@typescript-eslint/return-await": "error",
"@typescript-eslint/no-deprecated": "error",
"@typescript-eslint/no-duplicate-type-constituents": "off",
"@typescript-eslint/no-this-alias": "error",
"@typescript-eslint/no-use-before-define": "off",
Expand All @@ -188,72 +170,37 @@ module.exports =
"varsIgnorePattern": "^_",
}
],
"@typescript-eslint/no-var-requires": "error",
'@typescript-eslint/no-unused-expressions': 'off',
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/prefer-includes": "off",
"@typescript-eslint/prefer-namespace-keyword": "error",
"@typescript-eslint/prefer-regexp-exec": "off",
"@typescript-eslint/prefer-string-starts-ends-with": "off",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/quotes": [
"error",
"double",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
],
"@typescript-eslint/require-await": "off",
"@typescript-eslint/restrict-plus-operands": "off",
"@typescript-eslint/restrict-template-expressions": "off",
"@typescript-eslint/semi": [
"error",
"always"
],
"@typescript-eslint/space-before-function-paren": [
"error",
{
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}
],
"@typescript-eslint/triple-slash-reference": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/typedef": "off",
"@typescript-eslint/unbound-method": "error",
"@typescript-eslint/unified-signatures": "error",
"arrow-body-style": "off",
"arrow-parens": "error",
"brace-style": [
"error",
"1tbs",
{
"allowSingleLine": true
}
],
"camelcase": "off", // Using @typescript-eslint/naming-convention instead
"comma-dangle": [
"error",
"always-multiline"
],
"complexity": "off",
"constructor-super": "error",
"curly": [
"off",
"multi-line"
],
"deprecation/deprecation": "error",
"dot-notation": "off",
"@typescript-eslint/dot-notation": "error",
"eol-last": "error",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-blacklist": [
"id-denylist": [
"error",
"any",
"number",
Expand All @@ -262,17 +209,10 @@ module.exports =
"Undefined"
],
"id-match": "error",
"import/no-deprecated": "off", // using deprecation/deprecation instead
"import/no-deprecated": "off", // using @typescript-eslint/no-deprecated instead
"import/no-duplicates": "off", // using no-duplicate-imports instead
"import/order": "off",
"indent": "off", // note you must disable the base rule as it can report incorrect errors
"max-classes-per-file": "off",
"max-len": "off",
"max-statements-per-line": [
"error",
{ "max": 1 },
],
"new-parens": "error",
"no-bitwise": "off",
"no-caller": "error",
"no-cond-assign": "off",
Expand All @@ -283,7 +223,6 @@ module.exports =
"no-eval": "error",
"no-fallthrough": "error",
"no-invalid-this": "off",
"no-multiple-empty-lines": ["error", { max: 1 }],
"no-new-wrappers": "error",
"no-redeclare": "off", // using @typescript-eslint/no-redeclare instead
"no-restricted-properties": [
Expand All @@ -294,12 +233,10 @@ module.exports =
}
],
"no-restricted-syntax": ["error", { selector: "TSEnumDeclaration[const=true]", message: "const enums are not allowed" }],
"no-return-await": "off", // using @typescript-eslint/return-await instead
"no-shadow": "off", // using @typescript-eslint/no-shadow instead
"no-sparse-arrays": "error",
"no-template-curly-in-string": "error",
"no-throw-literal": "error",
"no-trailing-spaces": "error",
"no-undef-init": "error",
// TODO: The current implementation does not support the configurations we want to allow. Need to have it extended...
"no-underscore-dangle": [
Expand All @@ -311,14 +248,8 @@ module.exports =
}
],
"no-unsafe-finally": "error",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-unused-vars": "off", // Using @typescript-eslint/no-unused-vars instead
"no-var": "error",
"nonblock-statement-body-position": [
"error",
"below", // readability aside, you can't set breakpoint in debugger unless statement is on separate line.
],
"object-shorthand": "error",
"one-var": [
"off",
Expand All @@ -337,11 +268,6 @@ module.exports =
"prefer-rest-params": "off",
"prefer-spread": "off",
"prefer-template": "error",
"quote-props": [
"error",
"consistent-as-needed"
],
"quotes": "off", // Using @typescript-eslint/quotes instead
"radix": "error",
"sort-imports": [
"error",
Expand All @@ -350,35 +276,8 @@ module.exports =
"ignoreCase": true,
}
],
"spaced-comment": [
"error",
"always",
{
"exceptions": [
"-", // Ignore a '-' immediately after '/*' to allow our copyright header standard
"=",
"*",
],
"markers": [
"/",
]
}
],
"use-isnan": "error",
"valid-typeof": "off",
"@itwin/import-spacing": ["error", {
"allow-line-breaks": false, // line breaks not allowed
"allow-line-breaks-inside-brackets": true, // except inside brackets
// valid example: import {
// classA, classB,
// classC
// } from "module";
//
// invalid example: import
// { classA, classB }
// from
// "module";
}],
"@itwin/import-within-package": "error",
"@itwin/prefer-get": "error",
"@itwin/require-basic-rpc-values": "off",
Expand Down
2 changes: 1 addition & 1 deletion dist/configs/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports =
rules: {
...itwinjsRecommended.rules,
...jsxA11yPlugin.configs.recommended.rules,
...reactPlugin.configs.recommended.rules,
...reactPlugin.configs.flat.recommended.rules,
"jam3/no-sanitizer-with-danger": 2,
"max-statements-per-line": "off", // override itwinjs-recommended
"nonblock-statement-body-position": "off", // override itwinjs-recommended
Expand Down
5 changes: 5 additions & 0 deletions dist/plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
const rules = require("./rules");
const version = require("../package.json").version;

module.exports = {
meta: {
name: "@itwin/eslint-plugin",
version,
},
rules,
};
Loading

0 comments on commit aa162bb

Please sign in to comment.