Skip to content

Commit 45b2987

Browse files
fix(eslint): migrate to stylistic.configs.customize() after plugin update
- Replace deprecated string-based extends syntax ("stylistic/all") with stylistic.configs.customize() factory function - Move commaDangle configuration into customize() options for cleaner config - Fixes padded-blocks and other style rules being incorrectly applied after updating @stylistic/eslint-plugin from 5.x to 5.7.1 The string-based extends syntax stopped working with the latest update when used with defineConfig().
1 parent 549838f commit 45b2987

6 files changed

Lines changed: 19 additions & 23 deletions

File tree

eslint.config.mjs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {defineConfig, globalIgnores} from "eslint/config";
1+
import { defineConfig, globalIgnores } from "eslint/config";
22
import globals from "globals";
3-
import {flatConfigs as importX} from "eslint-plugin-import-x";
3+
import { flatConfigs as importX } from "eslint-plugin-import-x";
44
import js from "@eslint/js";
55
import jsdocPlugin from "eslint-plugin-jsdoc";
66
import packageJson from "eslint-plugin-package-json";
@@ -24,26 +24,25 @@ export default defineConfig([
2424
moment: "readonly"
2525
}
2626
},
27-
plugins: {js, stylistic},
28-
extends: [importX.recommended, "js/recommended", jsdocPlugin.configs["flat/recommended"], "stylistic/all"],
27+
plugins: { js, stylistic },
28+
extends: [importX.recommended, "js/recommended", jsdocPlugin.configs["flat/recommended"], stylistic.configs.customize({ indent: "tab", quotes: "double", semi: true, commaDangle: "never" })],
2929
rules: {
3030
"@stylistic/array-element-newline": ["error", "consistent"],
3131
"@stylistic/arrow-parens": ["error", "always"],
3232
"@stylistic/brace-style": "off",
33-
"@stylistic/comma-dangle": ["error", "never"],
3433
"@stylistic/dot-location": ["error", "property"],
3534
"@stylistic/function-call-argument-newline": ["error", "consistent"],
3635
"@stylistic/function-paren-newline": ["error", "consistent"],
3736
"@stylistic/implicit-arrow-linebreak": ["error", "beside"],
3837
"@stylistic/indent": ["error", "tab"],
39-
"@stylistic/max-statements-per-line": ["error", {max: 2}],
38+
"@stylistic/max-statements-per-line": ["error", { max: 2 }],
4039
"@stylistic/multiline-comment-style": "off",
4140
"@stylistic/multiline-ternary": ["error", "always-multiline"],
42-
"@stylistic/newline-per-chained-call": ["error", {ignoreChainWithDepth: 4}],
41+
"@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }],
4342
"@stylistic/no-extra-parens": "off",
4443
"@stylistic/no-tabs": "off",
4544
"@stylistic/object-curly-spacing": ["error", "always"],
46-
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
45+
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
4746
"@stylistic/operator-linebreak": ["error", "before"],
4847
"@stylistic/padded-blocks": "off",
4948
"@stylistic/quote-props": ["error", "as-needed"],
@@ -86,11 +85,11 @@ export default defineConfig([
8685
"js/logger.js",
8786
"tests/**/*.js"
8887
],
89-
rules: {"no-console": "error"}
88+
rules: { "no-console": "error" }
9089
},
9190
{
9291
files: ["**/package.json"],
93-
plugins: {packageJson},
92+
plugins: { packageJson },
9493
extends: ["packageJson/recommended"]
9594
},
9695
{
@@ -102,15 +101,15 @@ export default defineConfig([
102101
},
103102
sourceType: "module"
104103
},
105-
plugins: {js, stylistic},
106-
extends: [importX.recommended, "js/all", "stylistic/all"],
104+
plugins: { js, stylistic },
105+
extends: [importX.recommended, "js/all", stylistic.configs.customize({ indent: "tab", quotes: "double", semi: true, commaDangle: "never" })],
107106
rules: {
108107
"@stylistic/array-element-newline": "off",
109108
"@stylistic/indent": ["error", "tab"],
110-
"@stylistic/object-property-newline": ["error", {allowAllPropertiesOnSameLine: true}],
109+
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
111110
"@stylistic/padded-blocks": ["error", "never"],
112111
"@stylistic/quote-props": ["error", "as-needed"],
113-
"import-x/no-unresolved": ["error", {ignore: ["eslint/config"]}],
112+
"import-x/no-unresolved": ["error", { ignore: ["eslint/config"] }],
114113
"max-lines-per-function": ["error", 100],
115114
"no-magic-numbers": "off",
116115
"one-var": ["error", "never"],
@@ -124,7 +123,7 @@ export default defineConfig([
124123
...vitest.environments.env.globals
125124
}
126125
},
127-
plugins: {vitest},
126+
plugins: { vitest },
128127
extends: [vitest.configs.recommended],
129128
rules: {
130129
"vitest/consistent-test-it": "error",
@@ -142,7 +141,7 @@ export default defineConfig([
142141
]
143142
}
144143
],
145-
"vitest/max-nested-describe": ["error", {max: 3}],
144+
"vitest/max-nested-describe": ["error", { max: 3 }],
146145
"vitest/prefer-to-be": "error",
147146
"vitest/prefer-to-have-length": "error"
148147
}

modules/default/clock/clock.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ Module.register("clock", {
190190
}
191191

192192
sunWrapperInnerHTML += `<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ${formatTime(this.config, sunTimes.sunrise)}</span>`
193-
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${formatTime(this.config, sunTimes.sunset)}</span>`;
193+
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${formatTime(this.config, sunTimes.sunset)}</span>`;
194194

195195
sunWrapper.innerHTML = sunWrapperInnerHTML;
196196
digitalWrapper.appendChild(sunWrapper);
@@ -218,8 +218,8 @@ Module.register("clock", {
218218

219219
moonWrapper.innerHTML
220220
= `<span class="${isVisible ? "bright" : ""}">${image} ${showFraction ? illuminatedFractionString : ""}</span>`
221-
+ `<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ${moonRise ? formatTime(this.config, moonRise) : "..."}</span>`
222-
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${moonSet ? formatTime(this.config, moonSet) : "..."}</span>`;
221+
+ `<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ${moonRise ? formatTime(this.config, moonRise) : "..."}</span>`
222+
+ `<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ${moonSet ? formatTime(this.config, moonSet) : "..."}</span>`;
223223
digitalWrapper.appendChild(moonWrapper);
224224
}
225225

tests/configs/modules/calendar/symboltest.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
let config = {
32
address: "0.0.0.0",
43
ipWhitelist: [],

tests/e2e/helpers/global-setup.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ exports.getPage = () => {
8888
return page;
8989
};
9090

91-
9291
exports.startApplication = async (configFilename, exec) => {
9392
vi.resetModules();
9493

tests/unit/functions/http_fetcher_spec.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,4 +440,3 @@ describe("fetch() method", () => {
440440
expect(errorInfo.errorType).toBe("NETWORK_ERROR");
441441
});
442442
});
443-

vitest.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {defineConfig} from "vitest/config";
1+
import { defineConfig } from "vitest/config";
22

33
/*
44
* Sequential execution keeps our shared test server stable:

0 commit comments

Comments
 (0)