@moso/eslint-config 3.5.0 → 3.6.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 +86 -1
- package/dist/index.d.mts +1428 -509
- package/dist/index.mjs +410 -222
- package/package.json +37 -24
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ Flat ESLint config for JavaScript, TypeScript, Vue, React, and more.
|
|
|
11
11
|
- [ESLint Flat config](https://eslint.org/docs/latest/use/configure/configuration-files-new) with reasonable but opinionated defaults
|
|
12
12
|
- [Stylistic](https://eslint.style) with single quotes, semi enabled, sorted imports, and dangling commas
|
|
13
13
|
- Aimed to be used without Prettier
|
|
14
|
-
- Designed to work with JSX, TypeScript, Vue, React, Astro, Nuxt, and Next.js out of the box
|
|
14
|
+
- Designed to work with JSX, TypeScript, Vue, React, Preact, Svelte, Astro, Nuxt, SvelteKit, and Next.js out of the box
|
|
15
15
|
- Applies [Functional](https://github.com/eslint-functional/eslint-plugin-functional), [Perfectionist](https://perfectionist.dev), and [e18e](https://github.com/e18e/eslint-plugin) by default
|
|
16
16
|
- Lints for JSDoc, JSON, RegEx, TOML, and YAML
|
|
17
17
|
- Ships its own small [`@moso`](#custom-rules)-ruleset with security and hygiene rules
|
|
@@ -203,6 +203,17 @@ This section contains a list of the plugins used in the named configs that ship
|
|
|
203
203
|
</tr>
|
|
204
204
|
<tr>
|
|
205
205
|
<td valign="top">
|
|
206
|
+
<details><summary><strong>Preact</strong></summary>
|
|
207
|
+
|
|
208
|
+
[`@eslint-react`](https://eslint-react.xyz), [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks), [`eslint-plugin-react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh), [`eslint-plugin-jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
|
|
209
|
+
|
|
210
|
+
</details></td>
|
|
211
|
+
<td valign="top">☑️ℹ️</td>
|
|
212
|
+
<td valign="top">🎨</td>
|
|
213
|
+
<td valign="top">💭</td>
|
|
214
|
+
</tr>
|
|
215
|
+
<tr>
|
|
216
|
+
<td valign="top">
|
|
206
217
|
<details><summary><strong>React</strong></summary>
|
|
207
218
|
|
|
208
219
|
[`@eslint-react`](https://eslint-react.xyz), [`@eslint-react/dom`](https://eslint-react.xyz), [`@eslint-react/hooks-extra`](https://eslint-react.xyz), [`@eslint-react/naming-convention`](https://eslint-react.xyz), [`@eslint-react/web-api`](https://eslint-react.xyz), [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks), [`eslint-plugin-react-you-might-not-need-an-effect`](https://github.com/NickvanDyke/eslint-plugin-react-you-might-not-need-an-effect), [`eslint-plugin-jsx-a11y`](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y)
|
|
@@ -236,6 +247,17 @@ This section contains a list of the plugins used in the named configs that ship
|
|
|
236
247
|
</tr>
|
|
237
248
|
<tr>
|
|
238
249
|
<td valign="top">
|
|
250
|
+
<details><summary><strong>Svelte</strong></summary>
|
|
251
|
+
|
|
252
|
+
[`eslint-plugin-svelte`](https://sveltejs.github.io/eslint-plugin-svelte), [`svelte-eslint-parser`](https://github.com/sveltejs/svelte-eslint-parser)
|
|
253
|
+
|
|
254
|
+
</details></td>
|
|
255
|
+
<td valign="top">☑️</td>
|
|
256
|
+
<td valign="top">🎨</td>
|
|
257
|
+
<td valign="top">💭</td>
|
|
258
|
+
</tr>
|
|
259
|
+
<tr>
|
|
260
|
+
<td valign="top">
|
|
239
261
|
<details><summary><strong>TailwindCSS</strong></summary>
|
|
240
262
|
|
|
241
263
|
[`eslint-plugin-better-tailwindcss`](https://github.com/schoero/eslint-plugin-better-tailwindcss)
|
|
@@ -504,7 +526,9 @@ export default moso({
|
|
|
504
526
|
|
|
505
527
|
// Auto-detected, or enable explicitly
|
|
506
528
|
astro: true,
|
|
529
|
+
preact: true,
|
|
507
530
|
react: true,
|
|
531
|
+
svelte: true,
|
|
508
532
|
typescript: true,
|
|
509
533
|
vue: true,
|
|
510
534
|
|
|
@@ -695,6 +719,34 @@ bun add -d eslint-plugin-astro astro-eslint-parser
|
|
|
695
719
|
> Since Astro can be plugged with other frameworks as well, you'll be prompted to install the required packages for linting those as well. Example: If you have installed `@astrojs/react`, you'll be prompted to install the required packages to lint React.
|
|
696
720
|
|
|
697
721
|
|
|
722
|
+
### Preact
|
|
723
|
+
|
|
724
|
+
Auto-detected if you have Preact or the `@astrojs/preact` Astro framework integration installed. Enable explicitly:
|
|
725
|
+
|
|
726
|
+
```ts
|
|
727
|
+
// eslint.config.*
|
|
728
|
+
import moso from '@moso/eslint-config';
|
|
729
|
+
|
|
730
|
+
export default moso({
|
|
731
|
+
preact: true,
|
|
732
|
+
});
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
Install dependencies when prompted, or manually:
|
|
736
|
+
|
|
737
|
+
```shell
|
|
738
|
+
# npm
|
|
739
|
+
npm install -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
740
|
+
|
|
741
|
+
# pnpm
|
|
742
|
+
pnpm add -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
743
|
+
|
|
744
|
+
# Bun
|
|
745
|
+
bun add -d @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh
|
|
746
|
+
```
|
|
747
|
+
|
|
748
|
+
Replaces [`eslint-config-preact`](https://github.com/preactjs/eslint-config-preact), which doesn't support ESLint v10. Based on [`@eslint-react`'s Preact example](https://github.com/Rel1cx/eslint-react/blob/main/examples/preact/eslint.config.js). `@eslint-react` assumes React 19 semantics (e.g. `ref` as a prop instead of `forwardRef`).
|
|
749
|
+
|
|
698
750
|
### React
|
|
699
751
|
|
|
700
752
|
Auto-detected if you have React, Next.js, Nextra, Remix, Gatsby, or the `@astrojs/react` Astro framework integration installed. Enable explicitly:
|
|
@@ -721,6 +773,39 @@ pnpm add -D @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-
|
|
|
721
773
|
bun add -d @eslint-react/eslint-plugin eslint-plugin-react-hooks eslint-plugin-react-refresh eslint-plugin-react-you-might-not-need-an-effect
|
|
722
774
|
```
|
|
723
775
|
|
|
776
|
+
### Svelte
|
|
777
|
+
|
|
778
|
+
Auto-detected if you have Svelte or SvelteKit installed. Enable explicitly:
|
|
779
|
+
|
|
780
|
+
```ts
|
|
781
|
+
// eslint.config.*
|
|
782
|
+
import moso from '@moso/eslint-config';
|
|
783
|
+
|
|
784
|
+
export default moso({
|
|
785
|
+
svelte: true,
|
|
786
|
+
});
|
|
787
|
+
```
|
|
788
|
+
|
|
789
|
+
Install dependencies when prompted, or manually:
|
|
790
|
+
|
|
791
|
+
```shell
|
|
792
|
+
# npm
|
|
793
|
+
npm install -D eslint-plugin-svelte svelte-eslint-parser
|
|
794
|
+
|
|
795
|
+
# pnpm
|
|
796
|
+
pnpm add -D eslint-plugin-svelte svelte-eslint-parser
|
|
797
|
+
|
|
798
|
+
# Bun
|
|
799
|
+
bun add -d eslint-plugin-svelte svelte-eslint-parser
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
Lints `.svelte` components as well as `.svelte.js` and `.svelte.ts` rune modules. A few things differ from the rest of the config:
|
|
803
|
+
|
|
804
|
+
- `let` is how Svelte declares state and props (`$state`, `$props`, `export let`), so `functional/no-let` is disabled for Svelte files, and rune modules don't need the `mut_`-prefix. [`svelte/prefer-const`](https://sveltejs.github.io/eslint-plugin-svelte/rules/prefer-const) takes over from `prefer-const`, and ignores `$props` and `$derived`
|
|
805
|
+
- Attributes in markup use double quotes, regardless of the `quotes` setting for JavaScript
|
|
806
|
+
- With TypeScript enabled, `<script>`-blocks must use `lang="ts"` (unless `lessOpinionated: true`)
|
|
807
|
+
- `src/lib` (SvelteKit's `$lib`) is linted, even though `**/lib` is ignored by default, and `.svelte-kit` is ignored
|
|
808
|
+
|
|
724
809
|
### Vue
|
|
725
810
|
|
|
726
811
|
Auto-detected if you have Vue, Nuxt, VitePress, or the `@astrojs/vue` Astro framework integration installed. Enable explicitly:
|