Migrate to ESLint 9 (#6685)

* 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/ (https://github.com/standard/standard/issues/1948)

fix broken Dependabot PRs such as https://github.com/FreshRSS/FreshRSS/pull/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
This commit is contained in:
Alexandre Alapetite
2024-08-04 19:40:14 +02:00
committed by GitHub
parent e269418a46
commit b6f7c31e4c
7 changed files with 1191 additions and 611 deletions

View File

@@ -1,6 +0,0 @@
.git/
*.min.js
extensions/
node_modules/
p/scripts/vendor/
vendor/

View File

@@ -1,29 +0,0 @@
{
"env": {
"browser": true
},
"extends": [
"eslint:recommended",
"standard"
],
"rules": {
"camelcase": "off",
"comma-dangle": ["warn", {
"arrays": "always-multiline",
"objects": "always-multiline"
}],
"eqeqeq": "off",
"indent": ["warn", "tab", { "SwitchCase": 1 }],
"linebreak-style": ["error", "unix"],
"max-len": ["warn", 165],
"no-tabs": "off",
"semi": ["warn", "always"],
"space-before-function-paren": ["warn", {
"anonymous": "always",
"named": "never",
"asyncArrow": "always"
}],
"yoda": "off"
},
"root": true
}

View File

@@ -13,10 +13,12 @@ updates:
groups:
eslint:
patterns:
- "eslint*"
- "*eslint*"
- "globals"
- "neostandard"
stylelint:
patterns:
- "stylelint*"
- "*stylelint*"
- package-ecosystem: "composer"
directory: "/"
schedule:

View File

@@ -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

55
eslint.config.js Normal file
View File

@@ -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",
}],
},
},
];

1684
package-lock.json generated
View File

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
{
"name": "freshrss",
"type": "module",
"description": "A free, self-hostable aggregator",
"homepage": "https://freshrss.org/",
"readmeFilename": "README.md",
@@ -19,11 +20,11 @@
},
"license": "AGPL-3.0",
"engines": {
"node": ">=16"
"node": ">=18"
},
"scripts": {
"eslint": "eslint --ext .js .",
"eslint_fix": "eslint --fix --ext .js .",
"eslint": "eslint .",
"eslint_fix": "eslint --fix .",
"markdownlint": "markdownlint '**/*.md'",
"markdownlint_fix": "markdownlint --fix '**/*.md'",
"rtlcss": "rtlcss -d p/themes/ && find p/themes/ -type f -name '*.rtl.rtl.css' -delete",
@@ -33,15 +34,14 @@
"fix": "npm run rtlcss && npm run stylelint_fix && npm run eslint_fix && npm run markdownlint_fix"
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"eslint": "^9.8.0",
"@eslint/js": "^9.8.0",
"globals": "^15.9.0",
"markdownlint-cli": "^0.41.0",
"neostandard": "^0.11.2",
"rtlcss": "^4.2.0",
"sass": "^1.77.8",
"stylelint": "^16.6.1",
"stylelint": "^16.8.1",
"stylelint-config-recommended-scss": "^14.1.0",
"stylelint-order": "^6.0.4",
"@stylistic/stylelint-plugin": "^3.0.0"