Migrates ESLint configuration to new (9+) "flat format"

This commit is contained in:
Samuel FORESTIER 2024-04-24 23:01:01 +02:00
parent 7390a8056c
commit ee7649a8b4
3 changed files with 38 additions and 49 deletions

36
.eslint.config.mjs Normal file
View File

@ -0,0 +1,36 @@
// Thunderbird User.JS ESLint configuration file
import js from "@eslint/js";
export default [
js.configs.recommended,
{
rules: {
// Expect only double-quoted strings.
quotes: ["error", "double"],
// Expect a semicolon after each statement.
semi: ["error", "always", {"omitLastInOneLineBlock": false}],
// As project code style, don't allow tabulation nor trailing whitespaces.
"no-tabs": "error",
"no-trailing-spaces": "error",
// Don't allow whitespace before semicolons.
"semi-spacing": ["error", {"before": false}],
// Don't allow irregular whitespace characters in our sheet.
"no-irregular-whitespace": ["error", {"skipStrings": false, "skipComments": false}],
},
languageOptions: {
// From <https://searchfox.org/mozilla-central/rev/c938c7416c633639a5c8ce4412be586eefb48005/modules/libpref/parser/src/lib.rs#296>
globals: {
pref: "readonly",
user_pref: "readonly",
sticky: "readonly",
locked: "readonly",
sticky_pref: "readonly",
},
},
},
];

View File

@ -1,45 +0,0 @@
%YAML 1.2
---
root: true
extends: 'eslint:recommended'
globals:
# From <https://searchfox.org/mozilla-central/rev/c938c7416c633639a5c8ce4412be586eefb48005/modules/libpref/parser/src/lib.rs#296>
pref: true
user_pref: true
sticky: true
locked: true
sticky_pref: true
rules:
# Expect a semicolon after each statement.
semi:
- "error"
- "always"
-
omitLastInOneLineBlock: false
# As internal code style, don't allow tabulation.
no-tabs: "error"
# ... nor trailing spaces !
no-trailing-spaces: "error"
# Expect only double-quoted strings.
quotes:
- "error"
- "double"
# Don't allow whitespace before semicolons.
semi-spacing:
- "error"
-
before: false
# Don't allow irregular whitespace characters in our sheet.
no-irregular-whitespace:
- "error"
-
skipStrings: false
skipComments: false

View File

@ -7,13 +7,11 @@ jobs:
build:
name: Run ESLint on user.js
runs-on: ubuntu-latest
env:
ESLINT_USE_FLAT_CONFIG: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm install -g eslint
- run: eslint user.js
- run: npm install eslint @eslint/js
- run: npx eslint -c .eslint.config.mjs user.js