tools: Switch to flat config for eslint

Both the .json and .yml config formats are deprecated in favor
of flat configs exported from eslint.config.js files.

The good news is that gjs' config is now available as a shared
config from the `eslint-config-gnome` package in World/javascript,
so we no longer have to copy the entire thing.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell-extensions/-/merge_requests/408>
This commit is contained in:
Florian Müllner
2025-06-10 03:59:27 +02:00
committed by Marge Bot
parent f1e0058e67
commit 7d41858bab
4 changed files with 39 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
tools/eslint.config.js
+37
View File
@@ -0,0 +1,37 @@
// SPDX-FileCopyrightText: 2025 Florian Müllner <fmuellner@gnome.org>
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
import {defineConfig} from '@eslint/config-helpers';
import gnome from 'eslint-config-gnome';
export default defineConfig([
gnome.configs.recommended,
gnome.configs.jsdoc,
{
rules: {
camelcase: ['error', {
properties: 'never',
}],
'consistent-return': 'error',
'eqeqeq': ['error', 'smart'],
'key-spacing': ['error', {
mode: 'minimum',
beforeColon: false,
afterColon: true,
}],
'prefer-arrow-callback': 'error',
'jsdoc/require-param-description': 'off',
'jsdoc/require-jsdoc': ['error', {
exemptEmptyFunctions: true,
publicOnly: {
esm: true,
},
}],
},
languageOptions: {
globals: {
global: 'readonly',
},
},
},
]);
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -9,6 +9,6 @@
},
"dependencies": {
"ci-run-eslint": "git+https://gitlab.gnome.org/World/javascript/ci-run-eslint.git",
"eslint-plugin-jsdoc": "^48.11.0"
"eslint-config-gnome": "git+https://gitlab.gnome.org/World/javascript/eslint-config-gnome.git"
}
}