Skip to content

Commit

Permalink
Migrate to ESLint 9 (FreshRSS#6685)
Browse files Browse the repository at this point in the history
* Migrate to ESLint 9
* https://eslint.org/docs/latest/use/migrate-to-9.0.0
* https://eslint.style/guide/migration
* https://github.com/neostandard/neostandard/ (standard/standard#1948)

fix broken Dependabot PRs such as FreshRSS#6680

* comma-dangle rule is already included

* Use more standard filename

* More flexible syntax globals

* resolveIgnoresFromGitignore

* Dependabog update

* Relax object-shorthand

* GitHub action node-version

* GitHub action node-version again

* object-shorthand: off

* node >=18 due to dependencies
  • Loading branch information
Alkarex authored Aug 4, 2024
1 parent e269418 commit b6f7c31
Show file tree
Hide file tree
Showing 7 changed files with 1,158 additions and 578 deletions.
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

29 changes: 0 additions & 29 deletions .eslintrc.json

This file was deleted.

6 changes: 4 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ updates:
groups:
eslint:
patterns:
- "eslint*"
- "*eslint*"
- "globals"
- "neostandard"
stylelint:
patterns:
- "stylelint*"
- "*stylelint*"
- package-ecosystem: "composer"
directory: "/"
schedule:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
uses: actions/setup-node@v4
with:
# https://nodejs.org/en/about/previous-releases
node-version: '20'
cache: 'npm'
node-version: lts/*
cache: npm

- run: npm ci

Expand Down
55 changes: 55 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import globals from "globals";
import js from "@eslint/js";
import neostandard, { resolveIgnoresFromGitignore } from 'neostandard';
import stylistic from '@stylistic/eslint-plugin';

export default [
{
files: ["**/*.js"],
languageOptions: {
globals: {
...globals.browser,
},
sourceType: "script",
},
},
{
ignores: [
...resolveIgnoresFromGitignore(),
"**/*.min.js",
"extensions/",
"p/scripts/vendor/",
],
},
js.configs.recommended,
// stylistic.configs['recommended-flat'],
...neostandard(),
{
plugins: {
"@stylistic": stylistic,
},
rules: {
"camelcase": "off",
"eqeqeq": "off",
"no-empty": ["error", { "allowEmptyCatch": true }],
"no-unused-vars": ["error", {
"args": "none",
"caughtErrors": "none",
}],
"object-shorthand": "off",
"yoda": "off",
"@stylistic/indent": ["warn", "tab", { "SwitchCase": 1 }],
"@stylistic/linebreak-style": ["error", "unix"],
"@stylistic/max-len": ["warn", 165],
"@stylistic/no-tabs": "off",
"@stylistic/quotes": ["off", "single", { "avoidEscape": true }],
"@stylistic/quote-props": ["warn", "consistent"],
"@stylistic/semi": ["warn", "always"],
"@stylistic/space-before-function-paren": ["warn", {
"anonymous": "always",
"asyncArrow": "always",
"named": "never",
}],
},
},
];
Loading

0 comments on commit b6f7c31

Please sign in to comment.