mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-03 20:13:05 -04:00
[linter] Refactor ESLint config to use defineConfig
and globalIgnores
This commit is contained in:
parent
24a6bebedd
commit
a3d2064bb7
1 changed files with 21 additions and 22 deletions
|
@ -1,16 +1,13 @@
|
|||
import eslintPluginJest from "eslint-plugin-jest";
|
||||
import eslintPluginJs from "@eslint/js";
|
||||
import eslintPluginPackageJson from "eslint-plugin-package-json";
|
||||
import eslintPluginStylistic from "@stylistic/eslint-plugin";
|
||||
import {defineConfig, globalIgnores} from "eslint/config";
|
||||
import globals from "globals";
|
||||
import {flatConfigs as importX} from "eslint-plugin-import-x";
|
||||
import jest from "eslint-plugin-jest";
|
||||
import js from "@eslint/js";
|
||||
import packageJson from "eslint-plugin-package-json";
|
||||
import stylistic from "@stylistic/eslint-plugin";
|
||||
|
||||
const config = [
|
||||
eslintPluginJest.configs["flat/recommended"],
|
||||
eslintPluginJs.configs.recommended,
|
||||
eslintPluginPackageJson.configs.recommended,
|
||||
eslintPluginStylistic.configs.all,
|
||||
importX.recommended,
|
||||
export default defineConfig([
|
||||
globalIgnores(["config/**", "modules/**/*", "!modules/default/**", "js/positions.js"]),
|
||||
{
|
||||
files: ["**/*.js"],
|
||||
languageOptions: {
|
||||
|
@ -18,7 +15,6 @@ const config = [
|
|||
globals: {
|
||||
...globals.browser,
|
||||
...globals.node,
|
||||
...globals.jest,
|
||||
Log: "readonly",
|
||||
MM: "readonly",
|
||||
Module: "readonly",
|
||||
|
@ -26,6 +22,8 @@ const config = [
|
|||
moment: "readonly"
|
||||
}
|
||||
},
|
||||
plugins: {js, stylistic},
|
||||
extends: [importX.recommended, jest.configs["flat/recommended"], "js/recommended", "stylistic/all"],
|
||||
rules: {
|
||||
"@stylistic/array-element-newline": ["error", "consistent"],
|
||||
"@stylistic/arrow-parens": ["error", "always"],
|
||||
|
@ -81,11 +79,15 @@ const config = [
|
|||
"no-warning-comments": "off",
|
||||
"object-shorthand": ["error", "methods"],
|
||||
"one-var": "off",
|
||||
"prefer-destructuring": "off",
|
||||
"prefer-template": "error",
|
||||
"sort-keys": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
files: ["**/package.json"],
|
||||
plugins: {packageJson},
|
||||
extends: ["packageJson/recommended"]
|
||||
},
|
||||
{
|
||||
files: ["**/*.mjs"],
|
||||
languageOptions: {
|
||||
|
@ -95,17 +97,19 @@ const config = [
|
|||
},
|
||||
sourceType: "module"
|
||||
},
|
||||
plugins: {js, stylistic},
|
||||
extends: [importX.recommended, "js/all", "stylistic/all"],
|
||||
rules: {
|
||||
"@stylistic/array-element-newline": "off",
|
||||
"@stylistic/indent": ["error", "tab"],
|
||||
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
|
||||
"@stylistic/padded-blocks": ["error", "never"],
|
||||
"@stylistic/quote-props": ["error", "as-needed"],
|
||||
"func-style": "off",
|
||||
"import-x/no-unresolved": ["error", {ignore: ["eslint/config"]}],
|
||||
"max-lines-per-function": ["error", 100],
|
||||
"no-magic-numbers": "off",
|
||||
"one-var": "off",
|
||||
"prefer-destructuring": "off",
|
||||
"sort-keys": "error"
|
||||
"one-var": ["error", "never"],
|
||||
"sort-keys": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -113,10 +117,5 @@ const config = [
|
|||
rules: {
|
||||
"@stylistic/quotes": "off"
|
||||
}
|
||||
},
|
||||
{
|
||||
ignores: ["config/**", "modules/**/*", "!modules/default/**", "js/positions.js"]
|
||||
}
|
||||
];
|
||||
|
||||
export default config;
|
||||
]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue