@moso/eslint-config 3.1.0 → 3.3.0
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 +17 -16
- package/dist/index.d.mts +505 -462
- package/dist/index.mjs +324 -273
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @moso/eslint-config
|
|
2
2
|
|
|
3
|
-
[](https://npmx.dev/package/@moso/eslint-config)
|
|
4
|
-
[](https://npmx.dev/package/@moso/eslint-config)
|
|
4
|
+
[](https://codecov.io/gh/moso/eslint-config)
|
|
5
|
+
[](https://github.com/moso/eslint-config/blob/main/LICENSE)
|
|
5
6
|
|
|
6
7
|
Flat ESLint config for JavaScript, TypeScript, Vue, React, and more.
|
|
7
8
|
|
|
@@ -25,7 +26,7 @@ Flat ESLint config for JavaScript, TypeScript, Vue, React, and more.
|
|
|
25
26
|
|
|
26
27
|
## Configs
|
|
27
28
|
|
|
28
|
-
This section contains a list of the plugins used in the named configs that
|
|
29
|
+
This section contains a list of the plugins used in the named configs that ship with this shareable config.
|
|
29
30
|
|
|
30
31
|
\- ✅ Enabled by default
|
|
31
32
|
\- ☑️ Enabled by auto-detect
|
|
@@ -350,7 +351,7 @@ pnpm add -D eslint @moso/eslint-config
|
|
|
350
351
|
bun add -d eslint @moso/eslint-config
|
|
351
352
|
```
|
|
352
353
|
|
|
353
|
-
Create
|
|
354
|
+
Create an `eslint.config.*` in the root of your project. You can use `.js` or `.ts`; `.mjs`/`.cjs` also works.
|
|
354
355
|
|
|
355
356
|
> [!NOTE]
|
|
356
357
|
> If you use `.ts`, you will need to install [`jiti`](https://unjs.io/packages/jiti) as a developer dependency:
|
|
@@ -441,7 +442,7 @@ Add the following settings to your `.vscode/settings.json`:
|
|
|
441
442
|
"source.organizeImports": "never"
|
|
442
443
|
},
|
|
443
444
|
|
|
444
|
-
// You can
|
|
445
|
+
// You can silence specific rules in your IDE, but still auto fix them
|
|
445
446
|
"eslint.rules.customizations": [
|
|
446
447
|
{ "rule": "@stylistic/*", "severity": "off", "fixable": true },
|
|
447
448
|
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
|
@@ -643,7 +644,7 @@ export default moso({
|
|
|
643
644
|
});
|
|
644
645
|
```
|
|
645
646
|
|
|
646
|
-
This will enable the preset `recommended`, which is recommended starting rules for enforcing proper tag values, common tags
|
|
647
|
+
This will enable the preset `recommended`, which is recommended starting rules for enforcing proper tag values, common tags exist, and tags are formatted and styled consistently.
|
|
647
648
|
|
|
648
649
|
Individual rules can be tweaked with the `overrides` property:
|
|
649
650
|
|
|
@@ -717,12 +718,12 @@ npm install -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plug
|
|
|
717
718
|
pnpm add -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh eslint-plugin-react-you-might-not-need-an-effect
|
|
718
719
|
|
|
719
720
|
# Bun
|
|
720
|
-
bun add
|
|
721
|
+
bun add -d @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh eslint-plugin-react-you-might-not-need-an-effect
|
|
721
722
|
```
|
|
722
723
|
|
|
723
724
|
### Vue
|
|
724
725
|
|
|
725
|
-
Auto-detected if you have Vue, Nuxt, VitePress, or the `@astrojs/vue` Astro framework
|
|
726
|
+
Auto-detected if you have Vue, Nuxt, VitePress, or the `@astrojs/vue` Astro framework integration installed. Enable explicitly:
|
|
726
727
|
|
|
727
728
|
```ts
|
|
728
729
|
// eslint.config.*
|
|
@@ -743,11 +744,11 @@ npm install -D eslint-plugin-vue
|
|
|
743
744
|
pnpm add -D eslint-plugin-vue
|
|
744
745
|
|
|
745
746
|
# Bun
|
|
746
|
-
bun add
|
|
747
|
+
bun add -d eslint-plugin-vue
|
|
747
748
|
```
|
|
748
749
|
|
|
749
750
|
> [!CAUTION]
|
|
750
|
-
> Since Vue 2 has [reached EOL](https://v2.vuejs.org/eol), this config does not support Vue 2. If you need
|
|
751
|
+
> Since Vue 2 has [reached EOL](https://v2.vuejs.org/eol), this config does not support Vue 2. If you need support for Vue 2, you'll need to disable the imported configs from Vue 3, and replace them with the Vue 2 ones. You can see an inspiring example on [`eslint-plugin-vue`](https://eslint.vuejs.org/user-guide/#usage). I recommend upgrading to Vue 3 if possible.
|
|
751
752
|
|
|
752
753
|
### Typed Linting
|
|
753
754
|
|
|
@@ -831,7 +832,7 @@ Linting and auto-fixing before every commit is easy, you just add the following
|
|
|
831
832
|
```jsonc
|
|
832
833
|
{
|
|
833
834
|
"simple-git-hooks": {
|
|
834
|
-
"pre-commit": "
|
|
835
|
+
"pre-commit": "npx lint-staged" // or pnx/bunx
|
|
835
836
|
},
|
|
836
837
|
"nano-staged": {
|
|
837
838
|
"*": "eslint --fix"
|
|
@@ -853,18 +854,18 @@ bun add -d nano-staged simple-git-hooks
|
|
|
853
854
|
|
|
854
855
|
|
|
855
856
|
# to activate the hooks:
|
|
856
|
-
|
|
857
|
+
npx simple-git-hooks # npm
|
|
857
858
|
|
|
858
859
|
pnx simple-git-hooks # pnpm
|
|
859
860
|
|
|
860
|
-
bunx simple-git-hooks #
|
|
861
|
+
bunx simple-git-hooks # bun
|
|
861
862
|
```
|
|
862
863
|
|
|
863
864
|
## FAQ
|
|
864
865
|
|
|
865
866
|
### ESLint v9, older Node.js versions?
|
|
866
867
|
|
|
867
|
-
ESLint v9
|
|
868
|
+
ESLint v9 reached [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 have reached EOL unless absolutely necessary. The same goes with older Node.js versions.
|
|
868
869
|
|
|
869
870
|
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.
|
|
870
871
|
|
|
@@ -889,7 +890,7 @@ Optionally keep TypeScript 7's own `tsc` around as well:
|
|
|
889
890
|
{
|
|
890
891
|
"devDependencies": {
|
|
891
892
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
892
|
-
"typescript": "npm:@typescript/typescript6@^6.0.
|
|
893
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
893
894
|
}
|
|
894
895
|
}
|
|
895
896
|
```
|
|
@@ -943,7 +944,7 @@ You can still use these to format files that aren't linted with this config, how
|
|
|
943
944
|
|
|
944
945
|
You will need to install and configure [`stylelint`](https://stylelint.io) yourself, unfortunately.
|
|
945
946
|
|
|
946
|
-
|
|
947
|
+
`v3.2.0` added linting support for TailwindCSS, however.
|
|
947
948
|
|
|
948
949
|
### I prefer `this` or `that` rule
|
|
949
950
|
|