@moso/eslint-config 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist/index.d.mts +5 -1
- package/dist/index.mjs +73 -95
- package/package.json +23 -23
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ Flat ESLint config for JavaScript, TypeScript, Vue, React, and more.
|
|
|
9
9
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new) with reasonable but opinionated defaults
|
|
10
10
|
- [Stylistic](https://eslint.style) with single quotes, semi enabled, sorted imports, and dangling commas
|
|
11
11
|
- Aimed to be used without Prettier
|
|
12
|
-
- Designed to work with JSX, TypeScript, Vue, React, Astro, and Next.js out of the box
|
|
12
|
+
- Designed to work with JSX, TypeScript, Vue, React, Astro, Nuxt, and Next.js out of the box
|
|
13
13
|
- Applies [Functional](https://github.com/eslint-functional/eslint-plugin-functional), [Perfectionist](https://perfectionist.dev), and [e18e](https://github.com/e18e/eslint-plugin) by default
|
|
14
14
|
- Lints for JSDoc, JSON, RegEx, TOML, and YAML
|
|
15
|
-
- Ships its own small [`@moso`
|
|
15
|
+
- Ships its own small [`@moso`](#custom-rules)-ruleset with security and hygiene rules
|
|
16
16
|
- Every config can be enabled/disabled
|
|
17
17
|
- Respects `.gitignore` by default
|
|
18
|
-
- Requires
|
|
18
|
+
- Requires Node.js >= v22.23.x/v24.18.x, ESLint v10+
|
|
19
19
|
|
|
20
20
|
> [!NOTE]
|
|
21
21
|
> **Note regarding TypeScript v7**
|
|
@@ -779,6 +779,12 @@ bunx simple-git-hooks
|
|
|
779
779
|
|
|
780
780
|
## FAQ
|
|
781
781
|
|
|
782
|
+
### ESLint v9, older Node.js versions?
|
|
783
|
+
|
|
784
|
+
ESLint v9 will reach [EOL on August 6th, 2026](https://eslint.org/version-support). The world of development moves fast, and as with Vue v2.x, I don't intend to support versions that has reached EOL unless absolutely necessary. The same goes with older Node.js versions.
|
|
785
|
+
|
|
786
|
+
Even though ESLint v10 supports Node.js `v20.19.0` (as of current status), this version has also reached EOL. The rest of their requirements mention `v22.13.0` and `>= 24`. However, the minimum requirements of some of the configs that this sharable config apply rules from have a minimum requirement of `v22.22.3`, this project will stay within this range.
|
|
787
|
+
|
|
782
788
|
### TypeScript 7?
|
|
783
789
|
|
|
784
790
|
TypeScript 7.0 [does not ship a compiler API](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/) (a new one supposedly arrives in 7.1), so [`typescript-eslint`](https://typescript-eslint.io) - and therefore all TypeScript linting in this config - cannot run against it. TypeScript's supported setup is running TypeScript 6 side-by-side through the [`@typescript/typescript6`](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/#running-side-by-side-with-typescript-6.0) compatibility package, aliased so tooling that imports `typescript` keeps working:
|
package/dist/index.d.mts
CHANGED
|
@@ -1694,6 +1694,7 @@ interface RuleOptions {
|
|
|
1694
1694
|
/**
|
|
1695
1695
|
* Disallow function declarations that contain unsafe references inside loop statements
|
|
1696
1696
|
* @see https://typescript-eslint.io/rules/no-loop-func
|
|
1697
|
+
* @deprecated
|
|
1697
1698
|
*/
|
|
1698
1699
|
'@typescript-eslint/no-loop-func'?: Linter.RuleEntry<[]>;
|
|
1699
1700
|
/**
|
|
@@ -2350,6 +2351,7 @@ interface RuleOptions {
|
|
|
2350
2351
|
/**
|
|
2351
2352
|
* disallow omitted end tags
|
|
2352
2353
|
* @see https://ota-meshi.github.io/eslint-plugin-astro/rules/no-omitted-end-tags/
|
|
2354
|
+
* @deprecated
|
|
2353
2355
|
*/
|
|
2354
2356
|
'astro/no-omitted-end-tags'?: Linter.RuleEntry<[]>;
|
|
2355
2357
|
/**
|
|
@@ -2410,6 +2412,7 @@ interface RuleOptions {
|
|
|
2410
2412
|
/**
|
|
2411
2413
|
* disallow warnings when compiling.
|
|
2412
2414
|
* @see https://ota-meshi.github.io/eslint-plugin-astro/rules/valid-compile/
|
|
2415
|
+
* @deprecated
|
|
2413
2416
|
*/
|
|
2414
2417
|
'astro/valid-compile'?: Linter.RuleEntry<[]>;
|
|
2415
2418
|
/**
|
|
@@ -16137,6 +16140,7 @@ type VitestPreferExpectAssertions = [] | [{
|
|
|
16137
16140
|
onlyFunctionsWithAsyncKeyword?: boolean;
|
|
16138
16141
|
onlyFunctionsWithExpectInLoop?: boolean;
|
|
16139
16142
|
onlyFunctionsWithExpectInCallback?: boolean;
|
|
16143
|
+
disallowHasAssertions?: boolean;
|
|
16140
16144
|
}];
|
|
16141
16145
|
// ----- vitest/prefer-import-in-mock -----
|
|
16142
16146
|
type VitestPreferImportInMock = [] | [{
|
|
@@ -17745,7 +17749,7 @@ type YmlSpacedComment = [] | [("always" | "never")] | [("always" | "never"), {
|
|
|
17745
17749
|
markers?: string[];
|
|
17746
17750
|
}];
|
|
17747
17751
|
// Names of all the configs
|
|
17748
|
-
type ConfigNames = 'moso/eslint-comments' | 'moso/ignores/globals' | 'moso/ignores/gitignore' | 'moso/imports' | 'moso/imports/typescript' | 'moso/javascript' | 'moso/javascript/opinionated' | 'moso/node' | 'moso/promise' | 'moso/regexp' | 'moso/unicorn' | 'moso/astro/setup' | 'moso/astro/rules' | 'moso/e18e/rules' | 'moso/e18e/library-disables' | 'moso/functional' | 'moso/jsdoc' | 'moso/jsonc' | 'moso/sort/package-json' | 'moso/sort/tsconfig-json' | 'moso/jsx/setup' | 'moso/jsx/rules' | 'moso/jsx/a11y' | 'moso/nextjs/setup' | 'moso/nextjs/rules' | 'moso/perfectionist' | 'moso/react' | 'moso/react/typescript' | 'moso/react/typescript/type-aware-rules' | 'moso/
|
|
17752
|
+
type ConfigNames = 'moso/eslint-comments' | 'moso/ignores/globals' | 'moso/ignores/gitignore' | 'moso/imports' | 'moso/imports/typescript' | 'moso/javascript' | 'moso/javascript/opinionated' | 'moso/node' | 'moso/promise' | 'moso/regexp' | 'moso/unicorn' | 'moso/stylistic' | 'moso/astro/setup' | 'moso/astro/rules' | 'moso/e18e/rules' | 'moso/e18e/library-disables' | 'moso/functional' | 'moso/jsdoc' | 'moso/jsonc' | 'moso/sort/package-json' | 'moso/sort/tsconfig-json' | 'moso/jsx/setup' | 'moso/jsx/rules' | 'moso/jsx/a11y' | 'moso/nextjs/setup' | 'moso/nextjs/rules' | 'moso/perfectionist' | 'moso/react' | 'moso/react/typescript' | 'moso/react/typescript/type-aware-rules' | 'moso/test/setup' | 'moso/test/rules' | 'moso/toml/setup' | 'moso/toml/rules' | 'moso/typescript/setup' | 'moso/typescript/rules' | 'moso/typescript/erasable-syntax' | 'moso/typescript/rules-type-aware' | 'moso/typescript/dts-overrides' | 'moso/typescript/test-overrides' | 'moso/typescript/javascript-overrides' | 'moso/vue/setup' | 'moso/vue/rules' | 'moso/vue/rules-type-aware' | 'moso/vue/a11y' | 'moso/yaml/setup' | 'moso/yaml/rules' | 'moso/disables/bin' | 'moso/disables/cjs' | 'moso/disables/cli' | 'moso/disables/config-files' | 'moso/disables/dts' | 'moso/disables/scripts' | 'moso/disables/typings';
|
|
17749
17753
|
//#endregion
|
|
17750
17754
|
//#region src/types.d.ts
|
|
17751
17755
|
type Awaitable<T> = Promise<T> | T;
|
package/dist/index.mjs
CHANGED
|
@@ -222,6 +222,7 @@ const astro = async (options) => {
|
|
|
222
222
|
const stylisticEnabled = stylistic !== false;
|
|
223
223
|
const [typescriptParser] = typescript ? await loadPackages(["@typescript-eslint/parser"]) : [void 0];
|
|
224
224
|
const [astroParser, astroPlugin] = await loadPackages(["astro-eslint-parser", "eslint-plugin-astro"]);
|
|
225
|
+
const { projectService, ...typeAwareParserOptions } = parserOptions ?? {};
|
|
225
226
|
const flattenRules = (configs) => configs.reduce((acc, config) => Object.assign(acc, config.rules), {});
|
|
226
227
|
return [
|
|
227
228
|
{
|
|
@@ -233,7 +234,10 @@ const astro = async (options) => {
|
|
|
233
234
|
parserOptions: {
|
|
234
235
|
extraFileExtensions: [".astro"],
|
|
235
236
|
parser: typescript ? typescriptParser : void 0,
|
|
236
|
-
...typescript &&
|
|
237
|
+
...typescript && {
|
|
238
|
+
...typeAwareParserOptions,
|
|
239
|
+
...Boolean(projectService) && { project: true }
|
|
240
|
+
}
|
|
237
241
|
},
|
|
238
242
|
sourceType: "module"
|
|
239
243
|
},
|
|
@@ -246,12 +250,12 @@ const astro = async (options) => {
|
|
|
246
250
|
rules: {
|
|
247
251
|
"@moso/no-top-level-await": "off",
|
|
248
252
|
"node/no-top-level-await": "off",
|
|
253
|
+
"unicorn/no-await-expression-member": "off",
|
|
249
254
|
...flattenRules(astroPlugin.configs.recommended),
|
|
250
255
|
...!lessOpinionated && {
|
|
251
256
|
"astro/no-set-html-directive": "error",
|
|
252
257
|
"astro/no-set-text-directive": "error",
|
|
253
258
|
"astro/no-unsafe-inline-scripts": "error",
|
|
254
|
-
"astro/no-unused-css-selector": "error",
|
|
255
259
|
...stylisticEnabled && {
|
|
256
260
|
"astro/prefer-class-list-directive": "error",
|
|
257
261
|
"astro/prefer-object-class-list": "error",
|
|
@@ -369,7 +373,8 @@ const GLOB_EXCLUDE = [
|
|
|
369
373
|
"**/components.ts",
|
|
370
374
|
"**/components.d.ts",
|
|
371
375
|
"**/typegen.ts",
|
|
372
|
-
"**/typegen.d.ts"
|
|
376
|
+
"**/typegen.d.ts",
|
|
377
|
+
"**/*.css.ts"
|
|
373
378
|
];
|
|
374
379
|
//#endregion
|
|
375
380
|
//#region src/configs/disables.ts
|
|
@@ -682,8 +687,8 @@ const ignores = async (options) => {
|
|
|
682
687
|
var package_default = {
|
|
683
688
|
name: "@moso/eslint-config",
|
|
684
689
|
type: "module",
|
|
685
|
-
version: "3.0.
|
|
686
|
-
description: "
|
|
690
|
+
version: "3.0.2",
|
|
691
|
+
description: "@moso's sharable ESLint config",
|
|
687
692
|
author: {
|
|
688
693
|
"name": "Morten Sørensen",
|
|
689
694
|
"email": "morten@moso.dev",
|
|
@@ -720,7 +725,7 @@ var package_default = {
|
|
|
720
725
|
"./package.json",
|
|
721
726
|
"dist/"
|
|
722
727
|
],
|
|
723
|
-
engines: { "node": "^22.
|
|
728
|
+
engines: { "node": "^22.22.3 || >=24" },
|
|
724
729
|
scripts: {
|
|
725
730
|
"build": "bun run typegen && tsdown --clean --dts",
|
|
726
731
|
"build:inspector": "bun run build && bunx @eslint/config-inspector build --config eslint.config.ts --out-dir ./.eslint-config-inspector",
|
|
@@ -728,7 +733,7 @@ var package_default = {
|
|
|
728
733
|
"lint": "eslint",
|
|
729
734
|
"prepack": "bun run build",
|
|
730
735
|
"prepare": "bun run simple-git-hooks",
|
|
731
|
-
"release": "bumpp && bun publish",
|
|
736
|
+
"release": "bumpp --recursive && bun publish",
|
|
732
737
|
"test": "vitest run",
|
|
733
738
|
"test:update-snapshots": "vitest --update",
|
|
734
739
|
"typecheck": "tsc --noEmit",
|
|
@@ -737,11 +742,11 @@ var package_default = {
|
|
|
737
742
|
},
|
|
738
743
|
workspaces: ["src/rules"],
|
|
739
744
|
peerDependencies: {
|
|
740
|
-
"@eslint-react/eslint-plugin": "^5.14.
|
|
745
|
+
"@eslint-react/eslint-plugin": "^5.14.8",
|
|
741
746
|
"@next/eslint-plugin-next": "^16.2.10",
|
|
742
|
-
"astro-eslint-parser": "^
|
|
743
|
-
"eslint": "
|
|
744
|
-
"eslint-plugin-astro": "^
|
|
747
|
+
"astro-eslint-parser": "^3.0.0",
|
|
748
|
+
"eslint": "^10.0.0",
|
|
749
|
+
"eslint-plugin-astro": "^3.0.0",
|
|
745
750
|
"eslint-plugin-erasable-syntax-only": "^0.4.2",
|
|
746
751
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
747
752
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -772,19 +777,19 @@ var package_default = {
|
|
|
772
777
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
773
778
|
"@eslint/js": "^10.0.1",
|
|
774
779
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
775
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
776
|
-
"@typescript-eslint/parser": "^8.
|
|
777
|
-
"@typescript-eslint/utils": "^8.
|
|
778
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
780
|
+
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
|
781
|
+
"@typescript-eslint/parser": "^8.64.0",
|
|
782
|
+
"@typescript-eslint/utils": "^8.64.0",
|
|
783
|
+
"@vitest/eslint-plugin": "^1.6.23",
|
|
779
784
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
780
785
|
"eslint-flat-config-utils": "^3.2.0",
|
|
781
786
|
"eslint-merge-processors": "^2.0.0",
|
|
782
|
-
"eslint-plugin-de-morgan": "^2.1.
|
|
787
|
+
"eslint-plugin-de-morgan": "^2.1.3",
|
|
783
788
|
"eslint-plugin-functional": "^10.0.0",
|
|
784
789
|
"eslint-plugin-import-lite": "^0.6.0",
|
|
785
790
|
"eslint-plugin-jsdoc": "^63.0.13",
|
|
786
791
|
"eslint-plugin-jsonc": "^3.3.0",
|
|
787
|
-
"eslint-plugin-n": "^18.2.
|
|
792
|
+
"eslint-plugin-n": "^18.2.2",
|
|
788
793
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
789
794
|
"eslint-plugin-perfectionist": "^5.10.0",
|
|
790
795
|
"eslint-plugin-promise": "^7.3.0",
|
|
@@ -802,18 +807,18 @@ var package_default = {
|
|
|
802
807
|
"yaml-eslint-parser": "^2.1.0"
|
|
803
808
|
},
|
|
804
809
|
devDependencies: {
|
|
805
|
-
"@eslint-react/eslint-plugin": "^5.14.
|
|
810
|
+
"@eslint-react/eslint-plugin": "^5.14.8",
|
|
806
811
|
"@eslint/compat": "^2.1.0",
|
|
807
|
-
"@eslint/config-inspector": "^3.0
|
|
812
|
+
"@eslint/config-inspector": "^3.1.0",
|
|
808
813
|
"@moso/eslint-plugin": "workspace:*",
|
|
809
814
|
"@next/eslint-plugin-next": "^16.2.10",
|
|
810
815
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
811
816
|
"@types/node": "^26.1.1",
|
|
812
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
813
|
-
"astro-eslint-parser": "^
|
|
817
|
+
"@typescript-eslint/rule-tester": "^8.64.0",
|
|
818
|
+
"astro-eslint-parser": "^3.0.0",
|
|
814
819
|
"bumpp": "^11.1.0",
|
|
815
|
-
"eslint": "^10.
|
|
816
|
-
"eslint-plugin-astro": "^
|
|
820
|
+
"eslint": "^10.7.0",
|
|
821
|
+
"eslint-plugin-astro": "^3.0.0",
|
|
817
822
|
"eslint-plugin-erasable-syntax-only": "^0.4.2",
|
|
818
823
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
819
824
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -826,8 +831,8 @@ var package_default = {
|
|
|
826
831
|
"nano-staged": "^1.0.2",
|
|
827
832
|
"simple-git-hooks": "^2.13.1",
|
|
828
833
|
"ts-dedent": "^2.3.0",
|
|
829
|
-
"tsdown": "^0.22.
|
|
830
|
-
"tsx": "^4.23.
|
|
834
|
+
"tsdown": "^0.22.7",
|
|
835
|
+
"tsx": "^4.23.1",
|
|
831
836
|
"typescript": "^6.0.3",
|
|
832
837
|
"vitest": "^4.1.10"
|
|
833
838
|
},
|
|
@@ -1731,25 +1736,7 @@ const javascript = async (options) => {
|
|
|
1731
1736
|
"no-param-reassign": "error",
|
|
1732
1737
|
"no-proto": "error",
|
|
1733
1738
|
"no-redeclare": ["error", { builtinGlobals: true }],
|
|
1734
|
-
"no-restricted-globals":
|
|
1735
|
-
"error",
|
|
1736
|
-
{
|
|
1737
|
-
message: "Use local parameter instead.",
|
|
1738
|
-
name: "event"
|
|
1739
|
-
},
|
|
1740
|
-
{
|
|
1741
|
-
message: "Use `globalThis` instead.",
|
|
1742
|
-
name: "global"
|
|
1743
|
-
},
|
|
1744
|
-
{
|
|
1745
|
-
message: "Use `globalThis` instead.",
|
|
1746
|
-
name: "self"
|
|
1747
|
-
},
|
|
1748
|
-
{
|
|
1749
|
-
message: "Use `globalThis` instead.",
|
|
1750
|
-
name: "window"
|
|
1751
|
-
}
|
|
1752
|
-
],
|
|
1739
|
+
"no-restricted-globals": "off",
|
|
1753
1740
|
"no-restricted-properties": [
|
|
1754
1741
|
"error",
|
|
1755
1742
|
{
|
|
@@ -2106,6 +2093,7 @@ const jsx = async (options) => {
|
|
|
2106
2093
|
},
|
|
2107
2094
|
{
|
|
2108
2095
|
name: "moso/jsx/rules",
|
|
2096
|
+
files,
|
|
2109
2097
|
rules: {
|
|
2110
2098
|
...stylistic !== false && {
|
|
2111
2099
|
"@stylistic/jsx-curly-spacing": ["error", {
|
|
@@ -2121,6 +2109,7 @@ const jsx = async (options) => {
|
|
|
2121
2109
|
},
|
|
2122
2110
|
...jsxA11yPlugin ? [{
|
|
2123
2111
|
name: "moso/jsx/a11y",
|
|
2112
|
+
files,
|
|
2124
2113
|
plugins: { "jsx-a11y": memoize(jsxA11yPlugin, "eslint-plugin-jsx-a11y") },
|
|
2125
2114
|
rules: {
|
|
2126
2115
|
...lessOpinionated ? { ...(assert.ok(!Array.isArray(jsxA11yPlugin.flatConfigs.recommended)), jsxA11yPlugin.flatConfigs.recommended.rules) } : {
|
|
@@ -2303,6 +2292,7 @@ const node = async (options = {}) => {
|
|
|
2303
2292
|
}]],
|
|
2304
2293
|
"node/no-restricted-require": options.typescript ? "off" : ["error", [...restricedImports]],
|
|
2305
2294
|
"node/no-sync": "error",
|
|
2295
|
+
"node/no-unsupported-features/node-builtins": "off",
|
|
2306
2296
|
"node/prefer-global/buffer": ["error", "never"],
|
|
2307
2297
|
"node/prefer-global/console": ["error", "always"],
|
|
2308
2298
|
"node/prefer-promises/dns": "error",
|
|
@@ -2327,9 +2317,12 @@ const node = async (options = {}) => {
|
|
|
2327
2317
|
},
|
|
2328
2318
|
{
|
|
2329
2319
|
files: [
|
|
2320
|
+
GLOB_ASTRO,
|
|
2330
2321
|
GLOB_DTS,
|
|
2322
|
+
GLOB_JSX,
|
|
2331
2323
|
GLOB_TS,
|
|
2332
|
-
GLOB_TSX
|
|
2324
|
+
GLOB_TSX,
|
|
2325
|
+
GLOB_VUE
|
|
2333
2326
|
],
|
|
2334
2327
|
rules: {
|
|
2335
2328
|
"node/no-extraneous-import": "off",
|
|
@@ -2462,30 +2455,15 @@ const perfectionist = async (options) => {
|
|
|
2462
2455
|
ignoreCase: true,
|
|
2463
2456
|
type: "alphabetical"
|
|
2464
2457
|
}],
|
|
2465
|
-
"perfectionist/sort-jsx-props": [
|
|
2466
|
-
|
|
2467
|
-
{
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
type: "unsorted",
|
|
2471
|
-
useConfigurationIf: { tagMatchesPattern: "*Component$" }
|
|
2472
|
-
},
|
|
2473
|
-
{
|
|
2474
|
-
...commonOptions,
|
|
2475
|
-
ignoreCase: true,
|
|
2476
|
-
type: "unsorted",
|
|
2477
|
-
useConfigurationIf: { matchesAstSelector: "VariableDeclaration[kind=\"const\"] JSXElement" }
|
|
2458
|
+
"perfectionist/sort-jsx-props": ["error", {
|
|
2459
|
+
...commonOptions,
|
|
2460
|
+
fallbackSort: {
|
|
2461
|
+
order: "asc",
|
|
2462
|
+
type: "natural"
|
|
2478
2463
|
},
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
order: "asc",
|
|
2483
|
-
type: "natural"
|
|
2484
|
-
},
|
|
2485
|
-
ignoreCase: true,
|
|
2486
|
-
type: "alphabetical"
|
|
2487
|
-
}
|
|
2488
|
-
],
|
|
2464
|
+
ignoreCase: true,
|
|
2465
|
+
type: "alphabetical"
|
|
2466
|
+
}],
|
|
2489
2467
|
"perfectionist/sort-maps": [
|
|
2490
2468
|
"error",
|
|
2491
2469
|
{
|
|
@@ -3039,8 +3017,8 @@ const StylisticConfigDefaults = {
|
|
|
3039
3017
|
};
|
|
3040
3018
|
const stylistic = async (options) => {
|
|
3041
3019
|
const { experimental, indent, jsx, lessOpinionated, quotes, overrides, semi, typescript } = {
|
|
3042
|
-
...
|
|
3043
|
-
...
|
|
3020
|
+
...StylisticConfigDefaults,
|
|
3021
|
+
...options
|
|
3044
3022
|
};
|
|
3045
3023
|
const [stylisticPlugin] = await loadPackages(["@stylistic/eslint-plugin"]);
|
|
3046
3024
|
const config = stylisticPlugin.configs.customize({
|
|
@@ -3058,11 +3036,21 @@ const stylistic = async (options) => {
|
|
|
3058
3036
|
rules: {
|
|
3059
3037
|
...config.rules,
|
|
3060
3038
|
...!lessOpinionated && {
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3039
|
+
...!experimental && {
|
|
3040
|
+
"@stylistic/array-element-newline": ["error", {
|
|
3041
|
+
consistent: true,
|
|
3042
|
+
minItems: 4,
|
|
3043
|
+
multiline: true
|
|
3044
|
+
}],
|
|
3045
|
+
"@stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
3046
|
+
"@stylistic/function-paren-newline": ["error", "consistent"],
|
|
3047
|
+
"@stylistic/object-curly-newline": ["error", {
|
|
3048
|
+
consistent: true,
|
|
3049
|
+
minProperties: 4,
|
|
3050
|
+
multiline: true
|
|
3051
|
+
}],
|
|
3052
|
+
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }]
|
|
3053
|
+
},
|
|
3066
3054
|
"@stylistic/arrow-parens": ["error", "always"],
|
|
3067
3055
|
"@stylistic/block-spacing": ["error", "always"],
|
|
3068
3056
|
"@stylistic/brace-style": [
|
|
@@ -3087,8 +3075,6 @@ const stylistic = async (options) => {
|
|
|
3087
3075
|
"@stylistic/computed-property-spacing": "error",
|
|
3088
3076
|
"@stylistic/dot-location": ["error", "property"],
|
|
3089
3077
|
"@stylistic/eol-last": ["error", "always"],
|
|
3090
|
-
"@stylistic/function-call-argument-newline": ["error", "consistent"],
|
|
3091
|
-
"@stylistic/function-paren-newline": ["error", "consistent"],
|
|
3092
3078
|
"@stylistic/generator-star-spacing": ["error", "after"],
|
|
3093
3079
|
"@stylistic/indent": typescript ? "off" : [
|
|
3094
3080
|
"error",
|
|
@@ -3191,12 +3177,6 @@ const stylistic = async (options) => {
|
|
|
3191
3177
|
ignoreComments: true,
|
|
3192
3178
|
skipBlankLines: true
|
|
3193
3179
|
}],
|
|
3194
|
-
"@stylistic/object-curly-newline": ["error", {
|
|
3195
|
-
consistent: true,
|
|
3196
|
-
minProperties: 4,
|
|
3197
|
-
multiline: true
|
|
3198
|
-
}],
|
|
3199
|
-
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }],
|
|
3200
3180
|
"@stylistic/one-var-declaration-per-line": ["error", "always"],
|
|
3201
3181
|
"@stylistic/operator-linebreak": [
|
|
3202
3182
|
"error",
|
|
@@ -3404,7 +3384,6 @@ const typescript = async (options) => {
|
|
|
3404
3384
|
"no-extra-boolean-cast": "off",
|
|
3405
3385
|
"no-implied-eval": "off",
|
|
3406
3386
|
"no-invalid-this": "off",
|
|
3407
|
-
"no-loop-func": "off",
|
|
3408
3387
|
"no-loss-of-precision": "off",
|
|
3409
3388
|
"no-unused-vars": "off",
|
|
3410
3389
|
"no-use-before-define": "off",
|
|
@@ -3453,7 +3432,6 @@ const typescript = async (options) => {
|
|
|
3453
3432
|
"@typescript-eslint/no-explicit-any": unsafe,
|
|
3454
3433
|
"@typescript-eslint/no-import-type-side-effects": "error",
|
|
3455
3434
|
"@typescript-eslint/no-invalid-this": "off",
|
|
3456
|
-
"@typescript-eslint/no-loop-func": "error",
|
|
3457
3435
|
"@typescript-eslint/no-unused-expressions": ["error", {
|
|
3458
3436
|
allowShortCircuit: true,
|
|
3459
3437
|
allowTaggedTemplates: true,
|
|
@@ -4399,7 +4377,7 @@ async function moso(options, ...userConfigs) {
|
|
|
4399
4377
|
const typescriptVersion = (typescriptRequested === false ? void 0 : await getPackageInfo("typescript"))?.version;
|
|
4400
4378
|
const typescriptUnsupported = typescriptVersion !== void 0 && Number(typescriptVersion.split(".")[0]) >= 7;
|
|
4401
4379
|
if (typescriptUnsupported) {
|
|
4402
|
-
const message = `[@moso/eslint-config] TypeScript ${typescriptVersion} was detected, but TypeScript 7 does not ship a
|
|
4380
|
+
const message = `[@moso/eslint-config] TypeScript ${typescriptVersion} was detected, but TypeScript 7 does not ship a programmatic API, so @typescript-eslint (and therefore all TypeScript linting) cannot run against it.\n\n
|
|
4403
4381
|
Install the TypeScript 6 compatibility package side-by-side via an npm alias:\n\n
|
|
4404
4382
|
npm install -D typescript@npm:@typescript/typescript6\n\n
|
|
4405
4383
|
Optionally keep TypeScript 7's own tsc available as "@typescript/native": "npm:typescript@^7.0.2".\n
|
|
@@ -4421,11 +4399,11 @@ async function moso(options, ...userConfigs) {
|
|
|
4421
4399
|
const modeOptions = typeof options.mode === "string" ? options.mode : "none";
|
|
4422
4400
|
const perfectionistOptions = typeof options.perfectionist === "boolean" ? options.perfectionist : options.lessOpinionated !== true;
|
|
4423
4401
|
const projectRootOptions = typeof options.projectRoot === "string" ? checkFilePath(options.projectRoot) : typeof options.typescript === "object" && typeof options.typescript.projectRoot === "string" ? checkFilePath(options.typescript.projectRoot) : void 0;
|
|
4424
|
-
const stylisticOptions = options.stylistic === false ? false :
|
|
4402
|
+
const stylisticOptions = options.stylistic === false ? false : {
|
|
4425
4403
|
...StylisticConfigDefaults,
|
|
4426
4404
|
jsx: typeof jsxOptions === "boolean" ? jsxOptions : true,
|
|
4427
|
-
...options.stylistic
|
|
4428
|
-
}
|
|
4405
|
+
...typeof options.stylistic === "object" && options.stylistic
|
|
4406
|
+
};
|
|
4429
4407
|
const { filesTypeAware, ignoresTypeAware, parserOptions, useDefaultDefaultProject, ...typescriptSubOptions } = resolveSubOptions(options, "typescript");
|
|
4430
4408
|
const projectServiceUserConfig = {
|
|
4431
4409
|
defaultProject: "./tsconfig.json",
|
|
@@ -4499,6 +4477,12 @@ async function moso(options, ...userConfigs) {
|
|
|
4499
4477
|
overrides: getOverrides(options, "unicorn")
|
|
4500
4478
|
})
|
|
4501
4479
|
];
|
|
4480
|
+
if (stylisticOptions !== false) mut_configs.push(stylistic({
|
|
4481
|
+
...stylisticOptions,
|
|
4482
|
+
lessOpinionated: options.lessOpinionated,
|
|
4483
|
+
overrides: getOverrides(options, "stylistic"),
|
|
4484
|
+
typescript: hasTypeScript
|
|
4485
|
+
}));
|
|
4502
4486
|
if (astroOptions !== false) mut_configs.push(astro({
|
|
4503
4487
|
...typescriptConfigOptions,
|
|
4504
4488
|
files: [GLOB_ASTRO],
|
|
@@ -4572,12 +4556,6 @@ async function moso(options, ...userConfigs) {
|
|
|
4572
4556
|
typescript: hasTypeScript,
|
|
4573
4557
|
...resolveSubOptions(options, "react")
|
|
4574
4558
|
}));
|
|
4575
|
-
if (stylisticOptions !== false) mut_configs.push(stylistic({
|
|
4576
|
-
...stylisticOptions,
|
|
4577
|
-
lessOpinionated: options.lessOpinionated,
|
|
4578
|
-
overrides: getOverrides(options, "stylistic"),
|
|
4579
|
-
typescript: hasTypeScript
|
|
4580
|
-
}));
|
|
4581
4559
|
if (options.test !== false) mut_configs.push(test({
|
|
4582
4560
|
files: GLOB_TESTS,
|
|
4583
4561
|
isInEditor,
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moso/eslint-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "3.0.2",
|
|
5
|
+
"description": "@moso's sharable ESLint config",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Morten Sørensen",
|
|
8
8
|
"email": "morten@moso.dev",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dist/"
|
|
43
43
|
],
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": "^22.
|
|
45
|
+
"node": "^22.22.3 || >=24"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "bun run typegen && tsdown --clean --dts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"lint": "eslint",
|
|
52
52
|
"prepack": "bun run build",
|
|
53
53
|
"prepare": "bun run simple-git-hooks",
|
|
54
|
-
"release": "bumpp && bun publish",
|
|
54
|
+
"release": "bumpp --recursive && bun publish",
|
|
55
55
|
"test": "vitest run",
|
|
56
56
|
"test:update-snapshots": "vitest --update",
|
|
57
57
|
"typecheck": "tsc --noEmit",
|
|
@@ -62,11 +62,11 @@
|
|
|
62
62
|
"src/rules"
|
|
63
63
|
],
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@eslint-react/eslint-plugin": "^5.14.
|
|
65
|
+
"@eslint-react/eslint-plugin": "^5.14.8",
|
|
66
66
|
"@next/eslint-plugin-next": "^16.2.10",
|
|
67
|
-
"astro-eslint-parser": "^
|
|
68
|
-
"eslint": "
|
|
69
|
-
"eslint-plugin-astro": "^
|
|
67
|
+
"astro-eslint-parser": "^3.0.0",
|
|
68
|
+
"eslint": "^10.0.0",
|
|
69
|
+
"eslint-plugin-astro": "^3.0.0",
|
|
70
70
|
"eslint-plugin-erasable-syntax-only": "^0.4.2",
|
|
71
71
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
72
72
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -121,19 +121,19 @@
|
|
|
121
121
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.7.2",
|
|
122
122
|
"@eslint/js": "^10.0.1",
|
|
123
123
|
"@stylistic/eslint-plugin": "^5.10.0",
|
|
124
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
125
|
-
"@typescript-eslint/parser": "^8.
|
|
126
|
-
"@typescript-eslint/utils": "^8.
|
|
127
|
-
"@vitest/eslint-plugin": "^1.6.
|
|
124
|
+
"@typescript-eslint/eslint-plugin": "^8.64.0",
|
|
125
|
+
"@typescript-eslint/parser": "^8.64.0",
|
|
126
|
+
"@typescript-eslint/utils": "^8.64.0",
|
|
127
|
+
"@vitest/eslint-plugin": "^1.6.23",
|
|
128
128
|
"eslint-config-flat-gitignore": "^2.3.0",
|
|
129
129
|
"eslint-flat-config-utils": "^3.2.0",
|
|
130
130
|
"eslint-merge-processors": "^2.0.0",
|
|
131
|
-
"eslint-plugin-de-morgan": "^2.1.
|
|
131
|
+
"eslint-plugin-de-morgan": "^2.1.3",
|
|
132
132
|
"eslint-plugin-functional": "^10.0.0",
|
|
133
133
|
"eslint-plugin-import-lite": "^0.6.0",
|
|
134
134
|
"eslint-plugin-jsdoc": "^63.0.13",
|
|
135
135
|
"eslint-plugin-jsonc": "^3.3.0",
|
|
136
|
-
"eslint-plugin-n": "^18.2.
|
|
136
|
+
"eslint-plugin-n": "^18.2.2",
|
|
137
137
|
"eslint-plugin-no-only-tests": "^3.4.0",
|
|
138
138
|
"eslint-plugin-perfectionist": "^5.10.0",
|
|
139
139
|
"eslint-plugin-promise": "^7.3.0",
|
|
@@ -151,18 +151,18 @@
|
|
|
151
151
|
"yaml-eslint-parser": "^2.1.0"
|
|
152
152
|
},
|
|
153
153
|
"devDependencies": {
|
|
154
|
-
"@eslint-react/eslint-plugin": "^5.14.
|
|
154
|
+
"@eslint-react/eslint-plugin": "^5.14.8",
|
|
155
155
|
"@eslint/compat": "^2.1.0",
|
|
156
|
-
"@eslint/config-inspector": "^3.0
|
|
157
|
-
"@moso/eslint-plugin": "3.0.
|
|
156
|
+
"@eslint/config-inspector": "^3.1.0",
|
|
157
|
+
"@moso/eslint-plugin": "3.0.1",
|
|
158
158
|
"@next/eslint-plugin-next": "^16.2.10",
|
|
159
159
|
"@types/eslint-plugin-jsx-a11y": "^6.10.1",
|
|
160
160
|
"@types/node": "^26.1.1",
|
|
161
|
-
"@typescript-eslint/rule-tester": "^8.
|
|
162
|
-
"astro-eslint-parser": "^
|
|
161
|
+
"@typescript-eslint/rule-tester": "^8.64.0",
|
|
162
|
+
"astro-eslint-parser": "^3.0.0",
|
|
163
163
|
"bumpp": "^11.1.0",
|
|
164
|
-
"eslint": "^10.
|
|
165
|
-
"eslint-plugin-astro": "^
|
|
164
|
+
"eslint": "^10.7.0",
|
|
165
|
+
"eslint-plugin-astro": "^3.0.0",
|
|
166
166
|
"eslint-plugin-erasable-syntax-only": "^0.4.2",
|
|
167
167
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
168
168
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
@@ -175,8 +175,8 @@
|
|
|
175
175
|
"nano-staged": "^1.0.2",
|
|
176
176
|
"simple-git-hooks": "^2.13.1",
|
|
177
177
|
"ts-dedent": "^2.3.0",
|
|
178
|
-
"tsdown": "^0.22.
|
|
179
|
-
"tsx": "^4.23.
|
|
178
|
+
"tsdown": "^0.22.7",
|
|
179
|
+
"tsx": "^4.23.1",
|
|
180
180
|
"typescript": "^6.0.3",
|
|
181
181
|
"vitest": "^4.1.10"
|
|
182
182
|
},
|