eslint-config-un 1.0.0-beta.2 → 1.0.0-beta.4
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 +53 -53
- package/dist/config-un/config.mjs +7 -3
- package/dist/configs/css.mjs +1 -1
- package/dist/configs/extra/no-stylistic-rules.d.mts +25 -2
- package/dist/configs/extra/no-stylistic-rules.mjs +24 -1
- package/dist/configs/html.mjs +2 -2
- package/dist/configs/import.mjs +1 -1
- package/dist/configs/jest.mjs +1 -1
- package/dist/configs/nest-js.mjs +1 -1
- package/dist/configs/no-secrets.d.mts +5 -2
- package/dist/configs/no-secrets.mjs +2 -0
- package/dist/configs/perfectionist.d.mts +9 -1
- package/dist/configs/perfectionist.mjs +6 -2
- package/dist/configs/regexp.mjs +4 -1
- package/dist/configs/testing-library.mjs +1 -1
- package/dist/configs/ts.d.mts +3 -3
- package/dist/configs/ts.mjs +6 -2
- package/dist/configs/vue.d.mts +10 -4
- package/dist/configs/vue.mjs +7 -6
- package/dist/configs/zod.mjs +1 -1
- package/dist/eslint-rules.gen.mjs +21 -4
- package/dist/eslint-types-fixable-only.gen.d.mts +1 -1
- package/dist/eslint-types-per-plugin.gen.d.mts +958 -539
- package/dist/eslint-types.gen.d.mts +952 -533
- package/dist/eslint.d.mts +13 -7
- package/dist/eslint.mjs +47 -30
- package/dist/loaders/packages.d.mts +6 -6
- package/dist/loaders/plugins.d.mts +43 -35
- package/dist/package.mjs +19 -19
- package/dist/plugin-un/rules/no-typeof-like-comparisons.mjs +8 -3
- package/package.json +62 -62
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Grown out of the personal collection of rules, an ESLint config aspiring to cove
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Every major plugin** is included (100+ in total):
|
|
7
|
+
- **Every major plugin** is included (100+ in total):
|
|
8
8
|
[ Vanilla JS rules](https://eslint.org/docs/latest/rules),
|
|
9
9
|
[![TypeScript] typescript-eslint](https://typescript-eslint.io/rules),
|
|
10
10
|
[🦄unicorn](https://npmjs.com/eslint-plugin-unicorn),
|
|
@@ -42,17 +42,17 @@ pnpm i -D eslint-config-un eslint@latest
|
|
|
42
42
|
yarn add -D eslint-config-un eslint@latest # Yarn Berry only (v2+)
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
Commonly used plugins are direct dependencies of this package, you don't need to install them separately.
|
|
45
|
+
Commonly used plugins are direct dependencies of this package, you don't need to install them separately.
|
|
46
46
|
We aim to update the dependencies within 1 month after their release.
|
|
47
47
|
You can always override plugins' implementation with [`pluginOverrides` option](#pluginoverrides) or using your package manager's overrides functionality.
|
|
48
48
|
|
|
49
|
-
Certain plugins (usually framework/library specific ones) are optional peer dependencies, which means that you need to install them manually if they are end up being used.
|
|
49
|
+
Certain plugins (usually framework/library specific ones) are optional peer dependencies, which means that you need to install them manually if they are end up being used.
|
|
50
50
|
You need to run ESLint with our config once to find out which plugins should be installed manually.
|
|
51
51
|
|
|
52
52
|
<details>
|
|
53
53
|
<summary>Installation with Yarn Classic (v1)</summary>
|
|
54
54
|
|
|
55
|
-
Yarn Classic (v1) does not support installing packages by npm name that have dependencies referenced by `file:` protocol - which we're using in this package.
|
|
55
|
+
Yarn Classic (v1) does not support installing packages by npm name that have dependencies referenced by `file:` protocol - which we're using in this package.
|
|
56
56
|
It fails with "Tarball is not in network and can not be located in cache" error.
|
|
57
57
|
Installing directly from the tarball does work:
|
|
58
58
|
|
|
@@ -141,15 +141,15 @@ export default eslintConfig({
|
|
|
141
141
|
<!-- eslint-disable-next-line markdown-preferences/heading-casing -->
|
|
142
142
|
## Configs and Sub-configs
|
|
143
143
|
|
|
144
|
-
eslint-config-un has a concept of Configs and Sub-configs, further referred to as Configs.
|
|
144
|
+
eslint-config-un has a concept of Configs and Sub-configs, further referred to as Configs.
|
|
145
145
|
They are similar to ESLint flat config objects, but with some useful extensions.
|
|
146
146
|
Every Config is *usually* tied to a one or more ESLint plugins produces one or more ESLint flat config items.
|
|
147
147
|
|
|
148
|
-
You can enable any Config by setting it to `true` or an object with the Config's options.
|
|
149
|
-
Passing `false` disables the Config.
|
|
148
|
+
You can enable any Config by setting it to `true` or an object with the Config's options.
|
|
149
|
+
Passing `false` disables the Config.
|
|
150
150
|
Passing an empty array to `files` disables the Config, but not its' Sub-configs.
|
|
151
151
|
|
|
152
|
-
Sub-config is a Config located within Config's options.
|
|
152
|
+
Sub-config is a Config located within Config's options.
|
|
153
153
|
If the parent config is disabled by passing `false`, all its' Sub-configs are disabled too.
|
|
154
154
|
|
|
155
155
|
After evaluating all the flat configs, eslint-config-un will **load only those plugins that were actually used**, unless `loadPluginsOnDemand` option is set to `false`.
|
|
@@ -209,7 +209,7 @@ These are similar to ESLint's `rules`, but with a very important advantage: you
|
|
|
209
209
|
|
|
210
210
|
#### Sub-configs
|
|
211
211
|
|
|
212
|
-
Sub-configs are the same as Configs, but configured within Config options.
|
|
212
|
+
Sub-configs are the same as Configs, but configured within Config options.
|
|
213
213
|
All Sub-configs use `configXXX` naming convention.
|
|
214
214
|
|
|
215
215
|
#### `forceSeverity`
|
|
@@ -459,7 +459,7 @@ export default eslintConfig({
|
|
|
459
459
|
|
|
460
460
|
#### Providing user defined flag configs
|
|
461
461
|
|
|
462
|
-
You can provide your own configs by using `extraConfigs` option.
|
|
462
|
+
You can provide your own configs by using `extraConfigs` option.
|
|
463
463
|
The provided configs will be placed after all the eslint-config-un's configs, and before the config which disables Prettier incompatible rules for all files.
|
|
464
464
|
|
|
465
465
|
Example:
|
|
@@ -488,10 +488,10 @@ export default eslintConfig({
|
|
|
488
488
|
|
|
489
489
|
### Plugin prefixes (`pluginRenames` option)
|
|
490
490
|
|
|
491
|
-
ESLint plugins are registered with an arbitrary user-provided prefix, such as `unicorn` or `vue`.
|
|
491
|
+
ESLint plugins are registered with an arbitrary user-provided prefix, such as `unicorn` or `vue`.
|
|
492
492
|
Then the rule name are formed by combining the prefix with the rule name, for example `unicorn/no-useless-undefined`.
|
|
493
493
|
|
|
494
|
-
eslint-config-un provides the ability to change any registered plugin prefix.
|
|
494
|
+
eslint-config-un provides the ability to change any registered plugin prefix.
|
|
495
495
|
Additionally, some plugins are registered with a different prefix than their documentation suggests.
|
|
496
496
|
If you would like to rename them back or rename some other plugins, you can use `pluginRenames` option, which is a map from the "canonical" prefixes to the user defined ones.
|
|
497
497
|
|
|
@@ -516,7 +516,7 @@ If you would like to rename them back or rename some other plugins, you can use
|
|
|
516
516
|
|
|
517
517
|
### Disabling rule autofix
|
|
518
518
|
|
|
519
|
-
ESLint [doesn't (yet?) have the ability to disable autofix](https://github.com/eslint/rfcs/pull/125) for a rule by the user on per-rule basis.
|
|
519
|
+
ESLint [doesn't (yet?) have the ability to disable autofix](https://github.com/eslint/rfcs/pull/125) for a rule by the user on per-rule basis.
|
|
520
520
|
Our config attempts to provide this missing functionality by giving the ability to disable autofix for a rule as a whole ("globally") or per-file and per-rule basis, but in the latter case with a caveat that the rule will have `disable-autofix/` prefix in its name.
|
|
521
521
|
|
|
522
522
|
#### Globally disabling rule autofix
|
|
@@ -573,38 +573,38 @@ export default eslintConfig({
|
|
|
573
573
|
});
|
|
574
574
|
```
|
|
575
575
|
|
|
576
|
-
This will technically create a plugin with `disable-autofix` prefix and copy this rule into it.
|
|
576
|
+
This will technically create a plugin with `disable-autofix` prefix and copy this rule into it.
|
|
577
577
|
The final rule is going to be given a name `disable-autofix/<rule-name>` which would replace `<rule-name>` entry in the resulting config.
|
|
578
578
|
|
|
579
579
|
## Configs notes
|
|
580
580
|
|
|
581
581
|
### TypeScript
|
|
582
582
|
|
|
583
|
-
Rules [requiring type information](https://typescript-eslint.io/rules/?=typeInformation), which are [known to be performance-demanding](https://typescript-eslint.io/getting-started/typed-linting/#performance), are *enabled* by default, and will be applied to the same files as `ts` config is applied to.
|
|
583
|
+
Rules [requiring type information](https://typescript-eslint.io/rules/?=typeInformation), which are [known to be performance-demanding](https://typescript-eslint.io/getting-started/typed-linting/#performance), are *enabled* by default, and will be applied to the same files as `ts` config is applied to.
|
|
584
584
|
It's just a little heads up; you should make your own decision whether to keep them enabled.
|
|
585
585
|
Use `configTypeAware` to control to which files such rules will be applied to, if any.
|
|
586
586
|
|
|
587
587
|
### Frontend frameworks
|
|
588
588
|
|
|
589
|
-
We detect the version of the used frontend framework (Angular, Vue, Svelte, etc.) and apply the appropriate rules depending on the version.
|
|
589
|
+
We detect the version of the used frontend framework (Angular, Vue, Svelte, etc.) and apply the appropriate rules depending on the version.
|
|
590
590
|
You can always manually specify the version using an appropriate option.
|
|
591
591
|
Consult JSDoc of each config for more details.
|
|
592
592
|
|
|
593
593
|
#### Vue
|
|
594
594
|
|
|
595
|
-
By default, TypeScript rules will be enabled in `.vue` files if `enforceTypescriptInScriptSection` is set to `true` in vue's config options which in turn is *automatically* set to `true` if `ts` config is enabled.
|
|
596
|
-
If you have `.vue` files authored in both TypeScript and JavaScript, use `enforceTypescriptInScriptSection.{files,ignores}` to manually specify TS & JS Vue components respectively.
|
|
595
|
+
By default, TypeScript rules will be enabled in `.vue` files if `enforceTypescriptInScriptSection` is set to `true` in vue's config options which in turn is *automatically* set to `true` if `ts` config is enabled.
|
|
596
|
+
If you have `.vue` files authored in both TypeScript and JavaScript, use `enforceTypescriptInScriptSection.{files,ignores}` to manually specify TS & JS Vue components respectively.
|
|
597
597
|
It is not currently possible to apply different ESLint rules depending on the value of `lang` attribute of `<script>` SFC section.
|
|
598
598
|
|
|
599
599
|
#### Angular
|
|
600
600
|
|
|
601
|
-
We support Angular versions from 13 to 20, all at once.
|
|
602
|
-
You are expected to install `@angular-eslint/eslint-plugin` and `@angular-eslint/eslint-plugin-template` packages of the same major version as your Angular version, but installing a greater version would also likely work.
|
|
601
|
+
We support Angular versions from 13 to 20, all at once.
|
|
602
|
+
You are expected to install `@angular-eslint/eslint-plugin` and `@angular-eslint/eslint-plugin-template` packages of the same major version as your Angular version, but installing a greater version would also likely work.
|
|
603
603
|
With the latter, you can use the rules added in newer versions of `@angular-eslint/eslint-plugin*` on older Angular codebases.
|
|
604
604
|
|
|
605
605
|
#### React
|
|
606
606
|
|
|
607
|
-
We use rules from several plugins to lint your React code.
|
|
607
|
+
We use rules from several plugins to lint your React code.
|
|
608
608
|
You will be able to choose whether you would like to use only `@eslint-react/eslint-plugin` or `eslint-plugin-react`, or both, which is the default.
|
|
609
609
|
|
|
610
610
|
### Markdown
|
|
@@ -612,7 +612,7 @@ You will be able to choose whether you would like to use only `@eslint-react/esl
|
|
|
612
612
|
If `markdown` config is enabled (which is the default), the same rules provided by other configs will be applied to code blocks (\```lang ... \```) inside Markdown files.
|
|
613
613
|
This works because under the hood the plugin [`@eslint/markdown`](https://npmjs.com/@eslint/markdown) that provides that functionality will create virtual files for each code block with the same extension as specified after ```.
|
|
614
614
|
|
|
615
|
-
But applying certain rules for code blocks might not be desirable because some of them are too strict for the code that won't be executed anyway or even unfixable (like missing imports).
|
|
615
|
+
But applying certain rules for code blocks might not be desirable because some of them are too strict for the code that won't be executed anyway or even unfixable (like missing imports).
|
|
616
616
|
You can find the full list of disabled rules in `src/configs/markdown.ts` file.
|
|
617
617
|
|
|
618
618
|
### Tailwind CSS
|
|
@@ -637,13 +637,13 @@ See [Rules configuration](#rules-configuration-configs-and-extraconfigs-option).
|
|
|
637
637
|
|
|
638
638
|
### `ignores`
|
|
639
639
|
|
|
640
|
-
Specifies a list of globally ignored files.
|
|
640
|
+
Specifies a list of globally ignored files.
|
|
641
641
|
By default will be merged with our ignore patterns (also exported as [`DEFAULT_GLOBAL_IGNORES`](#default_global_ignores)), unless the object notation is used and the `override` property is set to `true`.
|
|
642
642
|
|
|
643
643
|
### `extraPlugins`
|
|
644
644
|
|
|
645
|
-
Allows to provide additional ESLint plugins.
|
|
646
|
-
Their prefixes and possibly rule names will appear in configs' `rules` property type.
|
|
645
|
+
Allows to provide additional ESLint plugins.
|
|
646
|
+
Their prefixes and possibly rule names will appear in configs' `rules` property type.
|
|
647
647
|
They, like all the built-in plugins, by default will be loaded only if used.
|
|
648
648
|
|
|
649
649
|
Note that their prefixes must not match the built-it/known ones (like `ts` or `unicorn`) or even prefixes you've set via [`pluginRenames`](#pluginrenames).
|
|
@@ -654,7 +654,7 @@ Sets [`linterOptions.{noInlineConfig,reportUnusedDisableDirectives,reportUnusedI
|
|
|
654
654
|
|
|
655
655
|
### `defaultConfigsStatus`
|
|
656
656
|
|
|
657
|
-
Quickly enable multiple configs at once.
|
|
657
|
+
Quickly enable multiple configs at once.
|
|
658
658
|
Possible options:
|
|
659
659
|
|
|
660
660
|
- `all-disabled`: consider all top level configs disabled unless explicitly enabled.
|
|
@@ -662,12 +662,12 @@ Possible options:
|
|
|
662
662
|
|
|
663
663
|
### `mode`
|
|
664
664
|
|
|
665
|
-
Type of your project, either application (`app`, default) or library (`lib`).
|
|
665
|
+
Type of your project, either application (`app`, default) or library (`lib`).
|
|
666
666
|
Will affect certain rules, actual list of which is written in JSDoc of this option.
|
|
667
667
|
|
|
668
668
|
### `forceSeverity`
|
|
669
669
|
|
|
670
|
-
Globally forces non-zero severity of all the rules configured by eslint-config-un (i.e. not within `overrides`, `overridesAny` or [`extraConfigs`](#extraconfigs)).
|
|
670
|
+
Globally forces non-zero severity of all the rules configured by eslint-config-un (i.e. not within `overrides`, `overridesAny` or [`extraConfigs`](#extraconfigs)).
|
|
671
671
|
This can also be configured per-config.
|
|
672
672
|
|
|
673
673
|
### `pluginRenames`
|
|
@@ -676,14 +676,14 @@ See [Plugin prefixes](#plugin-prefixes-pluginrenames-option).
|
|
|
676
676
|
|
|
677
677
|
### `pluginOverrides`
|
|
678
678
|
|
|
679
|
-
Override implementation of some of the plugins.
|
|
679
|
+
Override implementation of some of the plugins.
|
|
680
680
|
This can be useful when this config is used to lint a repository of one of the built-in plugins to provide development version of that plugin.
|
|
681
681
|
|
|
682
682
|
### `loadPluginsOnDemand`
|
|
683
683
|
|
|
684
684
|
This option allows to decide whether whether ESLint plugins will be loaded if they are actually used (`true` by default).
|
|
685
685
|
|
|
686
|
-
Using object notation, you can also specify concrete plugins that will be loaded.
|
|
686
|
+
Using object notation, you can also specify concrete plugins that will be loaded.
|
|
687
687
|
This can be useful if you enable certain plugin rules only be using [configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments).
|
|
688
688
|
|
|
689
689
|
### `autofixDisabledGloballyFor`
|
|
@@ -692,8 +692,8 @@ See [Globally disabling rule autofix](#globally-disabling-rule-autofix).
|
|
|
692
692
|
|
|
693
693
|
### `gitignore`
|
|
694
694
|
|
|
695
|
-
By default files from `.gitignore` (read from [the current working directory](https://nodejs.org/api/process.html#processcwd)) in the will be automatically added to the global [`ignores`](#ignores) list.
|
|
696
|
-
Set this option to `false` to disable this behavior.
|
|
695
|
+
By default files from `.gitignore` (read from [the current working directory](https://nodejs.org/api/process.html#processcwd)) in the will be automatically added to the global [`ignores`](#ignores) list.
|
|
696
|
+
Set this option to `false` to disable this behavior.
|
|
697
697
|
You may also provide an object which configures [eslint-config-flat-gitignore](https://npmjs.com/eslint-config-flat-gitignore), which actually provides this functionality.
|
|
698
698
|
|
|
699
699
|
### `offlineMode`
|
|
@@ -704,15 +704,15 @@ It can also be enabled by setting `ESLINT_CONFIG_UN_OFFLINE_MODE` environment va
|
|
|
704
704
|
|
|
705
705
|
### `cacheConfigs`
|
|
706
706
|
|
|
707
|
-
Enables flat config caching.
|
|
708
|
-
This option is enabled by default when running in editor (detected by [`is-in-editor`](https://npmjs.com/is-in-editor)).
|
|
707
|
+
Enables flat config caching.
|
|
708
|
+
This option is enabled by default when running in editor (detected by [`is-in-editor`](https://npmjs.com/is-in-editor)).
|
|
709
709
|
It can also be enabled by setting `ESLINT_CONFIG_UN_CACHE_CONFIGS` environment variable to non-empty string, but the explicitly passed value takes precedence.
|
|
710
710
|
|
|
711
711
|
There are 2 layers of caching:
|
|
712
712
|
|
|
713
|
-
- In memory: the cache will be stored in a global variable, and if it's preserved between ESLint extension process re-runs (it does at least in VSCode), it will be preferred over FS cache.
|
|
713
|
+
- In memory: the cache will be stored in a global variable, and if it's preserved between ESLint extension process re-runs (it does at least in VSCode), it will be preferred over FS cache.
|
|
714
714
|
This is an **extremely fast** caching option.
|
|
715
|
-
- In file system: the cache will be stored in `node_modules/.cache/eslint-config-un/config.json`.
|
|
715
|
+
- In file system: the cache will be stored in `node_modules/.cache/eslint-config-un/config.json`.
|
|
716
716
|
Note that in this case caching might fail if the config contains unserializable data, such as functions.
|
|
717
717
|
|
|
718
718
|
The cache, regardless of the storage, is considered fresh for 1 hour, unless one of the following is changed:
|
|
@@ -724,7 +724,7 @@ The cache, regardless of the storage, is considered fresh for 1 hour, unless one
|
|
|
724
724
|
|
|
725
725
|
### `disablePrettierIncompatibleRules`
|
|
726
726
|
|
|
727
|
-
Disables rules that are potentially conflicting with Prettier. [`eslint-config-prettier`](https://npmjs.com/eslint-config-prettier) is used under the hood, with a few exceptions.
|
|
727
|
+
Disables rules that are potentially conflicting with Prettier. [`eslint-config-prettier`](https://npmjs.com/eslint-config-prettier) is used under the hood, with a few exceptions.
|
|
728
728
|
Defaults to `true` if `prettier` package is installed.
|
|
729
729
|
|
|
730
730
|
### `useFastImport`
|
|
@@ -741,15 +741,15 @@ Re-exported default export from [`globals` package](https://npmjs.com/globals),
|
|
|
741
741
|
|
|
742
742
|
#### `isInCi`
|
|
743
743
|
|
|
744
|
-
The constant showing if the current process is *likely* running in CI.
|
|
744
|
+
The constant showing if the current process is *likely* running in CI.
|
|
745
745
|
Info provided by [`ci-info` package](https://npmjs.com/ci-info).
|
|
746
746
|
|
|
747
|
-
Use case: disable or enable certain rules or features in CI.
|
|
747
|
+
Use case: disable or enable certain rules or features in CI.
|
|
748
748
|
Use with caution!
|
|
749
749
|
|
|
750
750
|
#### `isInEditor`
|
|
751
751
|
|
|
752
|
-
The constant showing if the current process is *likely* running within editor.
|
|
752
|
+
The constant showing if the current process is *likely* running within editor.
|
|
753
753
|
Info provided by [`is-in-editor` package](https://npmjs.com/is-in-editor).
|
|
754
754
|
|
|
755
755
|
Use case: disable or enable certain rules or features in editor, likely to improve performance.
|
|
@@ -760,7 +760,7 @@ Use case: disable or enable certain rules or features in editor, likely to impro
|
|
|
760
760
|
|
|
761
761
|
#### `DEFAULT_GLOBAL_IGNORES`
|
|
762
762
|
|
|
763
|
-
Default list of global `ignores` values set by eslint-config-un.
|
|
763
|
+
Default list of global `ignores` values set by eslint-config-un.
|
|
764
764
|
See also [`ignores` option](#ignores)
|
|
765
765
|
|
|
766
766
|
#### `RuleOptions`
|
|
@@ -780,14 +780,14 @@ Please refer to JSDoc of exported symbols for proper documentation.
|
|
|
780
780
|
|
|
781
781
|
#### `createNoRestricted*Rule`
|
|
782
782
|
|
|
783
|
-
Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules.
|
|
783
|
+
Utility functions re-exported from [`eslint-no-restricted` package](https://npmjs.com/eslint-no-restricted) which generate `no-restricted-*` rules.
|
|
784
784
|
Please refer to [the package documentation](https://github.com/bradzacher/eslint-no-restricted#readme) for more info.
|
|
785
785
|
|
|
786
786
|
## FAQ
|
|
787
787
|
|
|
788
788
|
### How do I add my own flat configs?
|
|
789
789
|
|
|
790
|
-
Use `extraConfigs` option.
|
|
790
|
+
Use `extraConfigs` option.
|
|
791
791
|
The configs provided there will be placed after all the eslint-config-un's configs, and before the config which disables Prettier incompatible rules for all files.
|
|
792
792
|
These configs have a richer `rules` option, which allows you to apply more settings like `overrides` option does.
|
|
793
793
|
|
|
@@ -795,12 +795,12 @@ Alternatively, you can `await` the `eslintConfig()` function and then add your o
|
|
|
795
795
|
|
|
796
796
|
### Do I have to install any of the used plugins?
|
|
797
797
|
|
|
798
|
-
Many plugins are direct dependencies on this package, but the rest (the majority) are optional peer dependencies which means you're responsible for making sure they're installed. eslint-config-un will refuse to work if a plugin is used but not installed.
|
|
798
|
+
Many plugins are direct dependencies on this package, but the rest (the majority) are optional peer dependencies which means you're responsible for making sure they're installed. eslint-config-un will refuse to work if a plugin is used but not installed.
|
|
799
799
|
Please run ESLint with our config once to get the list of dependencies to be installed manually.
|
|
800
800
|
|
|
801
801
|
### How do I know how eslint-config-un configures rules?
|
|
802
802
|
|
|
803
|
-
It's too much to document, so please have a look at the source code of our config.
|
|
803
|
+
It's too much to document, so please have a look at the source code of our config.
|
|
804
804
|
All the configs are placed inside `src/configs` directory.
|
|
805
805
|
|
|
806
806
|
### How does exactly eslint-config-un knows if some package is installed?
|
|
@@ -809,7 +809,7 @@ We use [`import-meta-resolve`](https://npmjs.com/import-meta-resolve) package to
|
|
|
809
809
|
|
|
810
810
|
### How can I know which configs will be enabled, for which rules autofix will be disabled, etc.?
|
|
811
811
|
|
|
812
|
-
You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command.
|
|
812
|
+
You can enable the debug mode by setting `DEBUG=eslint-config-un` environment variable when running ESLint command.
|
|
813
813
|
We use [`obug` package](https://npmjs.com/obug) ([`debug`](https://npmjs.com/debug) alternative with compatible API) to print debug messages, so please refer to its documentation for more info.
|
|
814
814
|
|
|
815
815
|
Alternatively, you can use [`@eslint/config-inspector`](https://npmjs.com/@eslint/config-inspector) to inspect the final config.
|
|
@@ -818,7 +818,7 @@ Alternatively, you can use [`@eslint/config-inspector`](https://npmjs.com/@eslin
|
|
|
818
818
|
|
|
819
819
|
### Prerequisites
|
|
820
820
|
|
|
821
|
-
Node.JS and ESLint satisfy [minimum required versions](#installation).
|
|
821
|
+
Node.JS and ESLint satisfy [minimum required versions](#installation).
|
|
822
822
|
Please don't attempt to migrate to ESLint 9 and eslint-config-un at the same time.
|
|
823
823
|
|
|
824
824
|
### Migration guide
|
|
@@ -828,13 +828,13 @@ If necessary, any step should be additionally split into multiple commits.
|
|
|
828
828
|
Before committing, please do also run tests, formatter, other linters and tools to ensure that nothing became broken, if you have any.
|
|
829
829
|
|
|
830
830
|
1. Dependencies:
|
|
831
|
-
1. Remove **ALL** ESLint related *dev* dependencies - be it plugins, parsers, whatever else or `eslint` itself.
|
|
831
|
+
1. Remove **ALL** ESLint related *dev* dependencies - be it plugins, parsers, whatever else or `eslint` itself.
|
|
832
832
|
This ensures correct versions of plugins will be resolved by eslint-config-un and saves you from other weird and hard to debug problems.
|
|
833
833
|
2. Install `eslint-config-un` following [the installation instructions](#installation).
|
|
834
834
|
2. If you're using `.js` config file, we highly recommend that you migrate to `.ts` one, or at least add `@ts-check` TypeScript directive to the former.
|
|
835
835
|
Please don't forget install [`jiti`](https://npmjs.com/jiti) for ESLint to able be to read your TypeScript config file.
|
|
836
836
|
3. Following your intuition or/and configs' options JSDoc documentation, migrate the existing config to the closest eslint-config-un equivalent.
|
|
837
|
-
1. Run ESLint for the first time (without `--fix`!).
|
|
837
|
+
1. Run ESLint for the first time (without `--fix`!).
|
|
838
838
|
The list of dependencies to be installed might be shown to you.
|
|
839
839
|
Please review whether those plugins are actually used/needed and act accordingly: install necessary plugins and disable configs which require packages you do not wish to install.
|
|
840
840
|
2. Rename rules on existing [`eslint` configuration comments](https://eslint.org/docs/latest/use/configure/rules#using-configuration-comments) if they have different plugin prefixes (the most common case is that `typescript-eslint` plugin has `ts` prefix in eslint-config-un instead of `@typescript-eslint`) **OR** change prefixes using [`pluginRenames` option](#plugin-prefixes-pluginrenames-option).
|
|
@@ -861,12 +861,12 @@ Before committing, please do also run tests, formatter, other linters and tools
|
|
|
861
861
|
|
|
862
862
|
Please carefully review automatically applied fixes and do not forget about problems requiring manual intervention.
|
|
863
863
|
It might be worth to fix stylistic issues in two stages: auto and manually fixable problems.
|
|
864
|
-
2. Now set `configs.noStylisticRules` to `true` to disable purely stylistic rules and run ESLint for the first time with the new config.
|
|
865
|
-
Please don't use `--fix` option - this may complicate things as you will have less idea of what's changed (plus some autofixes may be unsafe to automatically apply).
|
|
864
|
+
2. Now set `configs.noStylisticRules` to `true` to disable purely stylistic rules and run ESLint for the first time with the new config.
|
|
865
|
+
Please don't use `--fix` option - this may complicate things as you will have less idea of what's changed (plus some autofixes may be unsafe to automatically apply).
|
|
866
866
|
Thoroughly go through the report and:
|
|
867
867
|
- Decide which rules need to be disabled, enabled or changed the options of;
|
|
868
868
|
- Decide which `eslint-ignore` comments are no longer relevant and should be removed;
|
|
869
|
-
- Possibly set `ts.allowDefaultProject` to include files which are not part of any TypeScript project (tsconfig file), but for which TypeScript type-aware rules (rules requiring type information) should still work.
|
|
869
|
+
- Possibly set `ts.allowDefaultProject` to include files which are not part of any TypeScript project (tsconfig file), but for which TypeScript type-aware rules (rules requiring type information) should still work.
|
|
870
870
|
Conversely, if for some files type-aware linting should be disabled, specify them in `ts.configTypeAware.ignores` option (or set `ts.configTypeAware` to `false` to disable type-aware linting altogether);
|
|
871
871
|
- Add `<!-- eslint-skip -->` comments before fenced code blocks in Markdown files for which code parsing is failing;
|
|
872
872
|
- Fix/resolve any other issues and difficulties.
|
|
@@ -876,7 +876,7 @@ Before committing, please do also run tests, formatter, other linters and tools
|
|
|
876
876
|
|
|
877
877
|
### Why are there reports from `node` plugin in my frontend code?
|
|
878
878
|
|
|
879
|
-
All code is assumed to be Node.JS code by default (`eslint-plugin-n` plugin is run on such code).
|
|
879
|
+
All code is assumed to be Node.JS code by default (`eslint-plugin-n` plugin is run on such code).
|
|
880
880
|
Please specify `files`, `ignores` or disable `node` config altogether to avoid false positives.
|
|
881
881
|
|
|
882
882
|
<!-- eslint-disable-next-line markdown-preferences/heading-casing -->
|
|
@@ -169,7 +169,7 @@ const eslintConfigInternal = async (options = {}, internalOptions = {}) => {
|
|
|
169
169
|
noStylisticRules: { enabled: getIsConfigEnabled$1("noStylisticRules", false) },
|
|
170
170
|
noUnsanitized: { enabled: getIsConfigEnabled$1("noUnsanitized") },
|
|
171
171
|
nx: { enabled: getIsConfigEnabled$1("nx", "nx") },
|
|
172
|
-
packageJson: { enabled: getIsConfigEnabled$1("packageJson"
|
|
172
|
+
packageJson: { enabled: getIsConfigEnabled$1("packageJson") },
|
|
173
173
|
perfectionist: { enabled: getIsConfigEnabled$1("perfectionist", false) },
|
|
174
174
|
playwright: { enabled: getIsConfigEnabled$1("playwright", "playwright") },
|
|
175
175
|
pnpm: { enabled: getIsConfigEnabled$1("pnpm", usedPackageManager?.name === "pnpm") },
|
|
@@ -379,11 +379,15 @@ const eslintConfigInternal = async (options = {}, internalOptions = {}) => {
|
|
|
379
379
|
...extraConfig,
|
|
380
380
|
name: configName
|
|
381
381
|
}, extraConfig.rules);
|
|
382
|
-
|
|
382
|
+
const extraConfigFinal = {
|
|
383
383
|
...omit(extraConfig, ["rules"]),
|
|
384
384
|
...extraConfig.rules && { rules: overridesResolved.rules },
|
|
385
385
|
name: configName
|
|
386
|
-
}
|
|
386
|
+
};
|
|
387
|
+
overridesResolved.removedRules.forEach((ruleName) => {
|
|
388
|
+
extraConfigFinal.rules && Reflect.deleteProperty(extraConfigFinal.rules, ruleName);
|
|
389
|
+
});
|
|
390
|
+
return [extraConfigFinal, ...overridesResolved.extraConfigs];
|
|
387
391
|
}),
|
|
388
392
|
loadUnConfig("noStylisticRules", () => import("../configs/extra/no-stylistic-rules.mjs")),
|
|
389
393
|
disablePrettierIncompatibleRules && interopDefault(import("eslint-config-prettier")).then((eslintConfigPrettier) => ({
|
package/dist/configs/css.mjs
CHANGED
|
@@ -19,7 +19,7 @@ var css_default = ((context, optionsRaw) => {
|
|
|
19
19
|
language: "css/css",
|
|
20
20
|
languageOptions: {
|
|
21
21
|
...tolerantMode && { tolerant: true },
|
|
22
|
-
customSyntax,
|
|
22
|
+
...customSyntax != null && { customSyntax },
|
|
23
23
|
...tailwindPackageInfo && (tailwindMajorVersion === 4 || tailwindMajorVersion === 3) && generatePackageToLoadProperty("customSyntax", "tailwindCsstree", { valueTransformFn: {
|
|
24
24
|
fn({ tailwindCsstree }, currentValue) {
|
|
25
25
|
return {
|
|
@@ -203,7 +203,17 @@ declare const ALL_STYLISTIC_RULES: {
|
|
|
203
203
|
};
|
|
204
204
|
readonly header: {};
|
|
205
205
|
readonly headers: {};
|
|
206
|
-
readonly html: {
|
|
206
|
+
readonly html: {
|
|
207
|
+
readonly 'attrs-newline': true;
|
|
208
|
+
readonly 'element-newline': true;
|
|
209
|
+
readonly indent: true;
|
|
210
|
+
readonly lowercase: true;
|
|
211
|
+
readonly 'no-extra-spacing-attrs': true;
|
|
212
|
+
readonly 'no-multiple-empty-lines': true;
|
|
213
|
+
readonly 'no-trailing-spaces': true;
|
|
214
|
+
readonly quotes: true;
|
|
215
|
+
readonly 'sort-attrs': true;
|
|
216
|
+
};
|
|
207
217
|
readonly import: {
|
|
208
218
|
readonly 'consistent-type-specifier-style': true;
|
|
209
219
|
readonly export: true;
|
|
@@ -221,6 +231,7 @@ declare const ALL_STYLISTIC_RULES: {
|
|
|
221
231
|
readonly 'no-alias-methods': true;
|
|
222
232
|
readonly 'no-interpolation-in-snapshots': true;
|
|
223
233
|
readonly 'no-test-prefixes': true;
|
|
234
|
+
readonly 'no-unneeded-async-expect-function': true;
|
|
224
235
|
readonly 'padding-around-after-all-blocks': true;
|
|
225
236
|
readonly 'padding-around-after-each-blocks': true;
|
|
226
237
|
readonly 'padding-around-all': true;
|
|
@@ -367,7 +378,7 @@ declare const ALL_STYLISTIC_RULES: {
|
|
|
367
378
|
readonly 'scripts-name-casing': true;
|
|
368
379
|
readonly 'sort-collections': true;
|
|
369
380
|
};
|
|
370
|
-
readonly perfectionist: Record<"sort-imports" | "sort-array-includes" | "sort-classes" | "sort-decorators" | "sort-enums" | "sort-exports" | "sort-heritage-clauses" | "sort-interfaces" | "sort-intersection-types" | "sort-jsx-props" | "sort-maps" | "sort-modules" | "sort-named-exports" | "sort-named-imports" | "sort-object-types" | "sort-objects" | "sort-sets" | "sort-switch-case" | "sort-union-types" | "sort-variable-declarations", true>;
|
|
381
|
+
readonly perfectionist: Record<"sort-imports" | "sort-array-includes" | "sort-classes" | "sort-decorators" | "sort-enums" | "sort-export-attributes" | "sort-exports" | "sort-heritage-clauses" | "sort-import-attributes" | "sort-interfaces" | "sort-intersection-types" | "sort-jsx-props" | "sort-maps" | "sort-modules" | "sort-named-exports" | "sort-named-imports" | "sort-object-types" | "sort-objects" | "sort-sets" | "sort-switch-case" | "sort-union-types" | "sort-variable-declarations", true>;
|
|
371
382
|
readonly pinia: {
|
|
372
383
|
readonly 'prefer-use-store-naming-convention': true;
|
|
373
384
|
};
|
|
@@ -442,10 +453,22 @@ declare const ALL_STYLISTIC_RULES: {
|
|
|
442
453
|
readonly 'grapheme-string-literal': true;
|
|
443
454
|
readonly 'hexadecimal-escape': true;
|
|
444
455
|
readonly 'letter-case': true;
|
|
456
|
+
readonly 'match-any': true;
|
|
445
457
|
readonly 'no-useless-character-class': true;
|
|
458
|
+
readonly 'prefer-character-class': true;
|
|
459
|
+
readonly 'prefer-d': true;
|
|
460
|
+
readonly 'prefer-named-backreference': true;
|
|
461
|
+
readonly 'prefer-named-capture-group': true;
|
|
462
|
+
readonly 'prefer-named-replacement': true;
|
|
463
|
+
readonly 'prefer-plus-quantifier': true;
|
|
446
464
|
readonly 'prefer-quantifier': true;
|
|
465
|
+
readonly 'prefer-question-quantifier': true;
|
|
447
466
|
readonly 'prefer-regexp-exec': true;
|
|
448
467
|
readonly 'prefer-regexp-test': true;
|
|
468
|
+
readonly 'prefer-result-array-groups': true;
|
|
469
|
+
readonly 'prefer-star-quantifier': true;
|
|
470
|
+
readonly 'prefer-unicode-codepoint-escapes': true;
|
|
471
|
+
readonly 'prefer-w': true;
|
|
449
472
|
readonly 'sort-alternatives': true;
|
|
450
473
|
readonly 'sort-character-class-elements': true;
|
|
451
474
|
readonly 'sort-flags': true;
|
|
@@ -195,7 +195,17 @@ const ALL_STYLISTIC_RULES = {
|
|
|
195
195
|
},
|
|
196
196
|
header: {},
|
|
197
197
|
headers: {},
|
|
198
|
-
html: {
|
|
198
|
+
html: {
|
|
199
|
+
"attrs-newline": true,
|
|
200
|
+
"element-newline": true,
|
|
201
|
+
indent: true,
|
|
202
|
+
lowercase: true,
|
|
203
|
+
"no-extra-spacing-attrs": true,
|
|
204
|
+
"no-multiple-empty-lines": true,
|
|
205
|
+
"no-trailing-spaces": true,
|
|
206
|
+
quotes: true,
|
|
207
|
+
"sort-attrs": true
|
|
208
|
+
},
|
|
199
209
|
import: {
|
|
200
210
|
"consistent-type-specifier-style": true,
|
|
201
211
|
export: true,
|
|
@@ -213,6 +223,7 @@ const ALL_STYLISTIC_RULES = {
|
|
|
213
223
|
"no-alias-methods": true,
|
|
214
224
|
"no-interpolation-in-snapshots": true,
|
|
215
225
|
"no-test-prefixes": true,
|
|
226
|
+
"no-unneeded-async-expect-function": true,
|
|
216
227
|
"padding-around-after-all-blocks": true,
|
|
217
228
|
"padding-around-after-each-blocks": true,
|
|
218
229
|
"padding-around-all": true,
|
|
@@ -412,10 +423,22 @@ const ALL_STYLISTIC_RULES = {
|
|
|
412
423
|
"grapheme-string-literal": true,
|
|
413
424
|
"hexadecimal-escape": true,
|
|
414
425
|
"letter-case": true,
|
|
426
|
+
"match-any": true,
|
|
415
427
|
"no-useless-character-class": true,
|
|
428
|
+
"prefer-character-class": true,
|
|
429
|
+
"prefer-d": true,
|
|
430
|
+
"prefer-named-backreference": true,
|
|
431
|
+
"prefer-named-capture-group": true,
|
|
432
|
+
"prefer-named-replacement": true,
|
|
433
|
+
"prefer-plus-quantifier": true,
|
|
416
434
|
"prefer-quantifier": true,
|
|
435
|
+
"prefer-question-quantifier": true,
|
|
417
436
|
"prefer-regexp-exec": true,
|
|
418
437
|
"prefer-regexp-test": true,
|
|
438
|
+
"prefer-result-array-groups": true,
|
|
439
|
+
"prefer-star-quantifier": true,
|
|
440
|
+
"prefer-unicode-codepoint-escapes": true,
|
|
441
|
+
"prefer-w": true,
|
|
419
442
|
"sort-alternatives": true,
|
|
420
443
|
"sort-character-class-elements": true,
|
|
421
444
|
"sort-flags": true,
|
package/dist/configs/html.mjs
CHANGED
|
@@ -16,10 +16,10 @@ var html_default = ((context, optionsRaw) => {
|
|
|
16
16
|
}], {
|
|
17
17
|
languageOptions: { ...parserOptions && { parserOptions } },
|
|
18
18
|
...pluginSettings && { settings: { html: pluginSettings } }
|
|
19
|
-
}).markCategory("Best Practice").addRule("max-element-depth", OFF).addRule("no-duplicate-attrs", ERROR).addRule("no-duplicate-class", ERROR).addRule("no-duplicate-id", ERROR).addRule("no-duplicate-in-head", ERROR).addRule("no-
|
|
19
|
+
}).markCategory("Best Practice").addRule("max-element-depth", OFF).addRule("no-duplicate-attrs", ERROR).addRule("no-duplicate-class", ERROR).addRule("no-duplicate-id", ERROR).addRule("no-duplicate-in-head", ERROR).addRule("no-ineffective-attrs", ERROR).addRule("no-inline-styles", OFF).addRule("no-invalid-entity", ERROR).addRule("no-nested-interactive", ERROR).addRule("no-obsolete-tags", ERROR).addRule("no-restricted-attr-values", OFF).addRule("no-restricted-attrs", OFF).addRule("no-restricted-tags", ERROR, [{ tagPatterns: getKeysOfTruthyValues({
|
|
20
20
|
...noRestrictedHtmlElementsDefault,
|
|
21
21
|
...optionsResolved.disallowedHtmlTags
|
|
22
|
-
}).map((tagName) => `^${tagName}$`) }]).addRule("no-script-style-type", ERROR).addRule("no-target-blank", ERROR).addRule("prefer-https", ERROR).addRule("require-attrs", OFF).addRule("require-button-type", ERROR).addRule("require-closing-tags", ERROR).addRule("require-doctype", ERROR).addRule("require-explicit-size", ERROR).addRule("require-li-container", ERROR).addRule("require-meta-charset", ERROR).addRule("use-baseline", WARNING).markCategory("SEO").addRule("no-multiple-h1", ERROR).addRule("require-lang", ERROR).addRule("require-meta-description", OFF).addRule("require-open-graph-protocol", OFF).addRule("require-title", ERROR).markCategory("Accessibility").addRule("no-abstract-roles", ERROR).addRule("no-accesskey-attrs", ERROR).addRule("no-aria-hidden-body", ERROR).addRule("no-aria-hidden-on-focusable", ERROR).addRule("no-empty-headings", ERROR).addRule("no-heading-inside-button", ERROR).addRule("no-invalid-role", ERROR).addRule("no-non-scalable-viewport", ERROR).addRule("no-positive-tabindex", ERROR).addRule("no-skip-heading-levels", OFF).addRule("require-form-method", OFF).addRule("require-frame-title", ERROR).addRule("require-img-alt", ERROR).addRule("require-input-label", ERROR).addRule("require-meta-viewport", ERROR).markCategory("Style").addRule("attrs-newline", OFF).addRule("element-newline", OFF).addRule("id-naming-convention", OFF).addRule("indent", OFF).addRule("lowercase", ERROR).addRule("no-extra-spacing-attrs", OFF).addRule("no-multiple-empty-lines", WARNING).addRule("no-trailing-spaces", WARNING).addRule("quotes", ERROR, ["double", { enforceTemplatedAttrValue: true }]).addRule("sort-attrs", OFF).enableConfigTesterForPlugin("@html-eslint").addOverrides();
|
|
22
|
+
}).map((tagName) => `^${tagName}$`) }]).addRule("no-script-style-type", ERROR).addRule("no-target-blank", ERROR).addRule("no-whitespace-only-children", ERROR).addRule("prefer-https", ERROR).addRule("require-attrs", OFF).addRule("require-button-type", ERROR).addRule("require-closing-tags", ERROR).addRule("require-doctype", ERROR).addRule("require-explicit-size", ERROR).addRule("require-li-container", ERROR).addRule("require-meta-charset", ERROR).addRule("use-baseline", WARNING).markCategory("SEO").addRule("no-multiple-h1", ERROR).addRule("require-lang", ERROR).addRule("require-meta-description", OFF).addRule("require-open-graph-protocol", OFF).addRule("require-title", ERROR).markCategory("Accessibility").addRule("no-abstract-roles", ERROR).addRule("no-accesskey-attrs", ERROR).addRule("no-aria-hidden-body", ERROR).addRule("no-aria-hidden-on-focusable", ERROR).addRule("no-empty-headings", ERROR).addRule("no-heading-inside-button", ERROR).addRule("no-invalid-role", ERROR).addRule("no-non-scalable-viewport", ERROR).addRule("no-positive-tabindex", ERROR).addRule("no-skip-heading-levels", OFF).addRule("require-form-method", OFF).addRule("require-frame-title", ERROR).addRule("require-img-alt", ERROR).addRule("require-input-label", ERROR).addRule("require-meta-viewport", ERROR).markCategory("Style").addRule("attrs-newline", OFF).addRule("element-newline", OFF).addRule("id-naming-convention", OFF).addRule("indent", OFF).addRule("lowercase", ERROR).addRule("no-extra-spacing-attrs", OFF).addRule("no-extra-spacing-text", WARNING, [{ skip: ["pre"] }]).addRule("no-multiple-empty-lines", WARNING).addRule("no-trailing-spaces", WARNING).addRule("quotes", ERROR, ["double", { enforceTemplatedAttrValue: true }]).addRule("sort-attrs", OFF).enableConfigTesterForPlugin("@html-eslint").addOverrides();
|
|
23
23
|
return {
|
|
24
24
|
configs: [configBuilder],
|
|
25
25
|
optionsResolved
|
package/dist/configs/import.mjs
CHANGED
|
@@ -16,7 +16,7 @@ var import_default = (async (context, optionsRaw) => {
|
|
|
16
16
|
configBuilder?.addConfig(["import", {
|
|
17
17
|
includeDefaultFilesAndIgnores: true,
|
|
18
18
|
ignoresFallback: [GLOB_MARKDOWN_ALL_CODE_BLOCKS],
|
|
19
|
-
|
|
19
|
+
ignoresFallbackMergedWithUserIgnores: true
|
|
20
20
|
}], { settings: {
|
|
21
21
|
...isTypescriptEnabled && (await import("eslint-plugin-import-x")).configs.typescript.settings,
|
|
22
22
|
...generatePackageToLoadProperty("import-x/resolver-next", ["importResolverTypescript", "eslintPluginImportX"], { valueTransformFn: {
|
package/dist/configs/jest.mjs
CHANGED
|
@@ -32,7 +32,7 @@ var jest_default = (async (context, optionsRaw) => {
|
|
|
32
32
|
configBuilder?.addConfig(["jest", {
|
|
33
33
|
includeDefaultFilesAndIgnores: true,
|
|
34
34
|
filesFallback: defaultJestFiles
|
|
35
|
-
}], defaultJestEslintConfig).addRule("consistent-test-it", optionsResolved.testDefinitionKeyword === false ? OFF : ERROR, generateConsistentTestItOptions(optionsResolved)).addRule("expect-expect", ERROR).addRule("max-expects", maxAssertionCalls == null ? OFF : ERROR, [{ max: maxAssertionCalls }]).addRule("max-nested-describe", maxNestedDescribes == null ? OFF : ERROR, [{ max: maxNestedDescribes }]).addRule("no-alias-methods", ERROR).addRule("no-commented-out-tests", WARNING).addRule("no-conditional-expect", ERROR).addRule("no-conditional-in-test", OFF).addRule("no-confusing-set-timeout", ERROR).addRule("no-deprecated-functions", ERROR).addRule("no-disabled-tests", WARNING).addRule("no-done-callback", ERROR).addRule("no-duplicate-hooks", ERROR).addRule("no-export", ERROR).addRule("no-focused-tests", ERROR).addRule("no-hooks", OFF).addRule("no-identical-title", ERROR).addRule("no-interpolation-in-snapshots", ERROR).addRule("no-jasmine-globals", ERROR).addRule("no-large-snapshots", OFF).addRule("no-mocks-import", ERROR).addRule("no-restricted-jest-methods", hasRestrictedMethods ? ERROR : OFF, [restrictedMethods || {}]).addRule("no-restricted-matchers", hasRestrictedMatchers ? ERROR : OFF, [restrictedMatchers || {}]).addRule("no-standalone-expect", ERROR).addRule("no-test-prefixes", ERROR).addRule("no-test-return-statement", ERROR).addRule("padding-around-after-all-blocks", getPaddingAroundSeverity("afterAll")).addRule("padding-around-after-each-blocks", getPaddingAroundSeverity("afterEach")).addRule("padding-around-all", OFF).addRule("padding-around-before-all-blocks", getPaddingAroundSeverity("beforeAll")).addRule("padding-around-before-each-blocks", getPaddingAroundSeverity("beforeEach")).addRule("padding-around-describe-blocks", getPaddingAroundSeverity("describe")).addRule("padding-around-expect-groups", getPaddingAroundSeverity("expect")).addRule("padding-around-test-blocks", getPaddingAroundSeverity("test")).addRule("prefer-called-with", OFF).addRule("prefer-comparison-matcher", ERROR).addRule("prefer-each", WARNING).addRule("prefer-ending-with-an-expect", WARNING).addRule("prefer-equality-matcher", ERROR).addRule("prefer-expect-assertions", OFF).addRule("prefer-expect-resolves", ERROR).addRule("prefer-hooks-in-order", ERROR).addRule("prefer-hooks-on-top", ERROR).addRule("prefer-importing-jest-globals", OFF).addRule("prefer-jest-mocked", ERROR).addRule("prefer-lowercase-title", ERROR).addRule("prefer-mock-promise-shorthand", ERROR).addRule("prefer-snapshot-hint", OFF).addRule("prefer-spy-on", ERROR).addRule("prefer-strict-equal", WARNING).addRule("prefer-to-be", ERROR).addRule("prefer-to-contain", ERROR).addRule("prefer-to-have-length", ERROR).addRule("prefer-todo", WARNING).addRule("require-hook", WARNING).addRule("require-to-throw-message", OFF).addRule("require-top-level-describe", OFF).addRule("valid-describe-callback", ERROR).addRule("valid-expect", ERROR, [{
|
|
35
|
+
}], defaultJestEslintConfig).addRule("consistent-test-it", optionsResolved.testDefinitionKeyword === false ? OFF : ERROR, generateConsistentTestItOptions(optionsResolved)).addRule("expect-expect", ERROR).addRule("max-expects", maxAssertionCalls == null ? OFF : ERROR, [{ max: maxAssertionCalls }]).addRule("max-nested-describe", maxNestedDescribes == null ? OFF : ERROR, [{ max: maxNestedDescribes }]).addRule("no-alias-methods", ERROR).addRule("no-commented-out-tests", WARNING).addRule("no-conditional-expect", ERROR).addRule("no-conditional-in-test", OFF).addRule("no-confusing-set-timeout", ERROR).addRule("no-deprecated-functions", ERROR).addRule("no-disabled-tests", WARNING).addRule("no-done-callback", ERROR).addRule("no-duplicate-hooks", ERROR).addRule("no-export", ERROR).addRule("no-focused-tests", ERROR).addRule("no-hooks", OFF).addRule("no-identical-title", ERROR).addRule("no-interpolation-in-snapshots", ERROR).addRule("no-jasmine-globals", ERROR).addRule("no-large-snapshots", OFF).addRule("no-mocks-import", ERROR).addRule("no-restricted-jest-methods", hasRestrictedMethods ? ERROR : OFF, [restrictedMethods || {}]).addRule("no-restricted-matchers", hasRestrictedMatchers ? ERROR : OFF, [restrictedMatchers || {}]).addRule("no-standalone-expect", ERROR).addRule("no-test-prefixes", ERROR).addRule("no-test-return-statement", ERROR).addRule("no-unneeded-async-expect-function", ERROR).addRule("padding-around-after-all-blocks", getPaddingAroundSeverity("afterAll")).addRule("padding-around-after-each-blocks", getPaddingAroundSeverity("afterEach")).addRule("padding-around-all", OFF).addRule("padding-around-before-all-blocks", getPaddingAroundSeverity("beforeAll")).addRule("padding-around-before-each-blocks", getPaddingAroundSeverity("beforeEach")).addRule("padding-around-describe-blocks", getPaddingAroundSeverity("describe")).addRule("padding-around-expect-groups", getPaddingAroundSeverity("expect")).addRule("padding-around-test-blocks", getPaddingAroundSeverity("test")).addRule("prefer-called-with", OFF).addRule("prefer-comparison-matcher", ERROR).addRule("prefer-each", WARNING).addRule("prefer-ending-with-an-expect", WARNING).addRule("prefer-equality-matcher", ERROR).addRule("prefer-expect-assertions", OFF).addRule("prefer-expect-resolves", ERROR).addRule("prefer-hooks-in-order", ERROR).addRule("prefer-hooks-on-top", ERROR).addRule("prefer-importing-jest-globals", OFF).addRule("prefer-jest-mocked", ERROR).addRule("prefer-lowercase-title", ERROR).addRule("prefer-mock-promise-shorthand", ERROR).addRule("prefer-snapshot-hint", OFF).addRule("prefer-spy-on", ERROR).addRule("prefer-strict-equal", WARNING).addRule("prefer-to-be", ERROR).addRule("prefer-to-contain", ERROR).addRule("prefer-to-have-been-called", OFF).addRule("prefer-to-have-been-called-times", OFF).addRule("prefer-to-have-length", ERROR).addRule("prefer-todo", WARNING).addRule("require-hook", WARNING).addRule("require-to-throw-message", OFF).addRule("require-top-level-describe", OFF).addRule("valid-describe-callback", ERROR).addRule("valid-expect", ERROR, [{
|
|
36
36
|
alwaysAwait: true,
|
|
37
37
|
...asyncMatchers?.length && { asyncMatchers },
|
|
38
38
|
...minAndMaxExpectArgs?.[0] != null && minAndMaxExpectArgs[0] >= 0 && { minArgs: minAndMaxExpectArgs[0] },
|
package/dist/configs/nest-js.mjs
CHANGED
|
@@ -9,7 +9,7 @@ var nest_js_default = ((context, optionsRaw) => {
|
|
|
9
9
|
configBuilder?.addConfig(["nest-js", {
|
|
10
10
|
includeDefaultFilesAndIgnores: true,
|
|
11
11
|
filesFallback: [GLOB_TS]
|
|
12
|
-
}]).markCategory("Nest Modules and Dependency Injection").addRule("injectable-should-be-provided", ERROR).addRule("provided-injected-should-match-factory-parameters", ERROR).markCategory("Nest Swagger").addRule("api-enum-property-best-practices", ERROR).addRule("api-method-should-specify-api-operation", ERROR).addRule("api-method-should-specify-api-response", ERROR).addRule("api-property-matches-property-optionality", ERROR).addRule("api-property-returning-array-should-set-array", ERROR).addRule("controllers-should-supply-api-tags", ERROR).markCategory("Preventing bugs").addRule("all-properties-are-whitelisted", ERROR).addRule("all-properties-have-explicit-defined", ERROR).addRule("no-duplicate-decorators", ERROR).addRule("param-decorator-name-matches-route-param", ERROR).addRule("
|
|
12
|
+
}]).markCategory("Nest Modules and Dependency Injection").addRule("injectable-should-be-provided", ERROR).addRule("provided-injected-should-match-factory-parameters", ERROR).addRule("use-dependency-injection", OFF).addRule("use-injectable-provided-token", ERROR).markCategory("Nest Swagger").addRule("api-enum-property-best-practices", ERROR).addRule("api-method-should-specify-api-operation", ERROR).addRule("api-method-should-specify-api-response", ERROR).addRule("api-operation-summary-description-capitalized", ERROR).addRule("api-property-matches-property-optionality", ERROR).addRule("api-property-returning-array-should-set-array", ERROR).addRule("api-property-should-have-api-extra-models", ERROR).addRule("controllers-should-supply-api-tags", ERROR).markCategory("Preventing bugs").addRule("all-properties-are-whitelisted", ERROR).addRule("all-properties-have-explicit-defined", ERROR).addRule("no-duplicate-decorators", ERROR).addRule("param-decorator-name-matches-route-param", ERROR).addRule("validate-nested-of-array-should-set-each", ERROR).addRule("validated-non-primitive-property-needs-type-decorator", ERROR).addRule("validation-pipe-should-use-forbid-unknown", ERROR).markCategory("Security").addRule("api-methods-should-be-guarded", OFF).markCategory("Code Consistency").addRule("sort-module-metadata-arrays", OFF).addRule("use-correct-endpoint-naming-convention", OFF).enableConfigTesterForPlugin("nestjs").addOverrides();
|
|
13
13
|
return {
|
|
14
14
|
configs: [configBuilder],
|
|
15
15
|
optionsResolved
|
|
@@ -5,8 +5,11 @@ import { EslintSeverity, GetRuleOptions, UnConfigOptions } from "../eslint.mjs";
|
|
|
5
5
|
//#region src/configs/no-secrets.d.ts
|
|
6
6
|
interface NoSecretsEslintConfigOptions<ExtraPlugins extends ExtraPluginsType = never> extends UnConfigOptions<ExtraPlugins, 'no-secrets'> {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 📁 Default `files`: <code>**/*.json</code>
|
|
9
|
+
*
|
|
10
|
+
* ❌ Default `ignores`: <code>**/package-lock.json</code>
|
|
11
|
+
*
|
|
12
|
+
* ⚠️ Will be merged with the user provided `ignores`
|
|
10
13
|
* @default true
|
|
11
14
|
*/
|
|
12
15
|
configJson?: boolean | UnConfigOptions<ExtraPlugins, 'no-secrets'>;
|
|
@@ -21,6 +21,8 @@ var no_secrets_default = ((context, optionsRaw) => {
|
|
|
21
21
|
configBuilderJson?.addConfig(["no-secrets/json", {
|
|
22
22
|
includeDefaultFilesAndIgnores: true,
|
|
23
23
|
filesFallback: [GLOB_JSON],
|
|
24
|
+
ignoresFallback: ["**/package-lock.json"],
|
|
25
|
+
ignoresFallbackMergedWithUserIgnores: true,
|
|
24
26
|
parser: "jsonc-eslint-parser"
|
|
25
27
|
}]).addRule("no-secrets", noSecretsSeverity, [noSecretsOptions]).addOverrides();
|
|
26
28
|
return {
|