@shayanthenerd/eslint-config 0.29.4 → 0.30.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 +166 -104
- package/dist/configs/astro.mjs +1 -1
- package/dist/configs/{base.mjs → javascript.mjs} +4 -4
- package/dist/configs/typescript.mjs +4 -4
- package/dist/configs/vue.mjs +5 -1
- package/dist/helpers/globs.mjs +9 -9
- package/dist/helpers/options/defaultOptions.mjs +20 -20
- package/dist/helpers/options/enableDetectedConfigs.mjs +4 -4
- package/dist/index.mjs +10 -10
- package/dist/rules/astro.mjs +5 -3
- package/dist/rules/baseline.mjs +2 -2
- package/dist/rules/css.mjs +4 -4
- package/dist/rules/html.mjs +6 -4
- package/dist/rules/importX.mjs +5 -5
- package/dist/rules/javascript.mjs +29 -29
- package/dist/rules/markdown.mjs +1 -1
- package/dist/rules/packageJson.mjs +1 -1
- package/dist/rules/perfectionist.mjs +1 -1
- package/dist/rules/react.mjs +3 -3
- package/dist/rules/tailwind.mjs +3 -3
- package/dist/rules/typescript.mjs +11 -7
- package/dist/rules/unicorn.mjs +2 -2
- package/dist/rules/vue.mjs +42 -42
- package/dist/types/eslint-schema.d.mts +8 -8
- package/dist/types/eslintRules.d.mts +3 -3
- package/dist/types/index.d.mts +13 -13
- package/dist/types/options/react.d.mts +1 -1
- package/dist/types/options/typescript.d.mts +2 -2
- package/package.json +10 -3
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { ESLintSchema } from "./eslint-schema.mjs";
|
|
2
2
|
import { DeepNonNullable, Tail } from "./helpers.mjs";
|
|
3
3
|
//#region src/types/eslintRules.d.ts
|
|
4
|
-
/*** CoreRules & PluginRules ***/
|
|
5
4
|
type RuleNames = keyof ESLintSchema;
|
|
6
5
|
type PluginRuleNames = Extract<RuleNames, `${string}/${string}`>;
|
|
7
6
|
type PluginNames = PluginRuleNames extends `${infer PluginName}/${string}` ? PluginName : never;
|
|
8
7
|
type PluginRuleset<PluginName extends PluginNames> = Extract<PluginRuleNames, `${PluginName}/${string}`>;
|
|
8
|
+
type JavascriptRuleNames = Exclude<RuleNames, PluginRuleNames>;
|
|
9
|
+
type JavascriptRules = Pick<ESLintSchema, JavascriptRuleNames>;
|
|
9
10
|
type PluginRules<PluginName extends PluginNames> = Pick<ESLintSchema, PluginRuleset<PluginName>>;
|
|
10
|
-
/*** RuleOptions ***/
|
|
11
11
|
type Rule<RuleName extends RuleNames> = DeepNonNullable<ESLintSchema>[RuleName];
|
|
12
12
|
type RuleConfigs<RuleName extends RuleNames> = Tail<Rule<RuleName>>;
|
|
13
13
|
type RuleOptions<RuleName extends RuleNames, Index extends (0 | 1 | 2) = 0> = NonNullable<RuleConfigs<RuleName>[Index]>;
|
|
14
14
|
//#endregion
|
|
15
|
-
export type { PluginRules, RuleOptions };
|
|
15
|
+
export type { JavascriptRules, PluginRules, RuleOptions };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PluginRules, RuleOptions } from "./eslintRules.mjs";
|
|
1
|
+
import { JavascriptRules, PluginRules, RuleOptions } from "./eslintRules.mjs";
|
|
2
2
|
import { VueOptions } from "./options/vue.mjs";
|
|
3
3
|
import { ZodOptions } from "./options/zod.mjs";
|
|
4
4
|
import { NuxtOptions } from "./options/nuxt.mjs";
|
|
@@ -8,7 +8,7 @@ import { BaselineOptions } from "./options/baseline.mjs";
|
|
|
8
8
|
import { MarkdownOptions } from "./options/markdown.mjs";
|
|
9
9
|
import { TailwindOptions } from "./options/tailwind.mjs";
|
|
10
10
|
import { StylisticOptions } from "./options/stylistic.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { TypescriptOptions } from "./options/typescript.mjs";
|
|
12
12
|
import { Linter } from "eslint";
|
|
13
13
|
//#region src/types/index.d.ts
|
|
14
14
|
type ConfigOverrides = Pick<Linter.Config, 'name' | 'files' | 'ignores' | 'plugins' | 'settings' | 'languageOptions'>;
|
|
@@ -41,7 +41,7 @@ interface Options {
|
|
|
41
41
|
* Specify the runtime environment.
|
|
42
42
|
*
|
|
43
43
|
* This is used by
|
|
44
|
-
* - `configs.
|
|
44
|
+
* - `configs.baseline` option (disabled when `env` is set to a value other than `'browser'`)
|
|
45
45
|
* - [ESLint: Specifying Globals](https://eslint.org/docs/latest/use/configure/language-options#using-configuration-files)
|
|
46
46
|
* - [perfectionist/sort-imports: `env` option](https://perfectionist.dev/rules/sort-imports#environment)
|
|
47
47
|
*
|
|
@@ -248,11 +248,17 @@ interface Options {
|
|
|
248
248
|
*/
|
|
249
249
|
astro?: boolean | ConfigWithOverrides<PluginRules<'astro'>>;
|
|
250
250
|
/**
|
|
251
|
-
*
|
|
251
|
+
* Use [eslint-plugin-baseline-js](https://github.com/3ru/eslint-plugin-baseline-js), [css/use-baseline](https://github.com/eslint/css/blob/main/docs/rules/use-baseline.md#options), [@html-eslint/use-baseline](https://html-eslint.org/docs/rules/use-baseline#options), and [@html-eslint/react/use-baseline](https://github.com/eslint/css/blob/main/docs/rules/use-baseline.md#options) to enforce the use of baseline features.
|
|
252
|
+
*
|
|
253
|
+
* @default true // `false` if `env` is set to a value other than `'browser'`
|
|
254
|
+
*/
|
|
255
|
+
baseline?: boolean | BaselineOptions;
|
|
256
|
+
/**
|
|
257
|
+
* Customize JavaScript (core) rules and options.
|
|
252
258
|
*
|
|
253
|
-
*
|
|
259
|
+
* This configuration cannot be disabled.
|
|
254
260
|
*/
|
|
255
|
-
|
|
261
|
+
javascript?: ConfigWithOverrides<JavascriptRules> & {
|
|
256
262
|
/**
|
|
257
263
|
* Enforce a maximum depth that blocks can be nested to reduce code complexity.
|
|
258
264
|
*
|
|
@@ -385,7 +391,7 @@ interface Options {
|
|
|
385
391
|
*
|
|
386
392
|
* @default false // `true` if "typescript" is detected in the dependencies when `autoDetectDeps` is enabled
|
|
387
393
|
*/
|
|
388
|
-
typescript?: boolean |
|
|
394
|
+
typescript?: boolean | TypescriptOptions;
|
|
389
395
|
/**
|
|
390
396
|
* Use [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) to enforce general best practices and catch common mistakes.
|
|
391
397
|
*
|
|
@@ -413,12 +419,6 @@ interface Options {
|
|
|
413
419
|
*/
|
|
414
420
|
functionStyle?: Partial<RuleOptions<'unicorn/consistent-function-style'>>;
|
|
415
421
|
};
|
|
416
|
-
/**
|
|
417
|
-
* Use [eslint-plugin-baseline-js](https://github.com/3ru/eslint-plugin-baseline-js), [css/use-baseline](https://github.com/eslint/css/blob/main/docs/rules/use-baseline.md#options), [@html-eslint/use-baseline](https://html-eslint.org/docs/rules/use-baseline#options), and [@html-eslint/react/use-baseline](https://github.com/eslint/css/blob/main/docs/rules/use-baseline.md#options) to enforce the use of baseline features.
|
|
418
|
-
*
|
|
419
|
-
* @default true // `false` if `env` is set to a value other than `'browser'`
|
|
420
|
-
*/
|
|
421
|
-
useBaseline?: boolean | BaselineOptions;
|
|
422
422
|
/**
|
|
423
423
|
* Use [eslint-plugin-vue](https://eslint.vuejs.org) to enforce Vue best practices, accessibility guidelines, stylistic rules, and identify mistakes.
|
|
424
424
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PluginRules, RuleOptions } from "../eslintRules.mjs";
|
|
2
2
|
import { ConfigWithOverrides } from "../index.mjs";
|
|
3
3
|
//#region src/types/options/react.d.ts
|
|
4
|
-
type ConfigRules = PluginRules<'react'>;
|
|
4
|
+
type ConfigRules = PluginRules<'@eslint-react'>;
|
|
5
5
|
interface ReactOptions extends ConfigWithOverrides<ConfigRules> {
|
|
6
6
|
/**
|
|
7
7
|
* Use [eslint-plugin-jsx-a11y](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y) and [@html-eslint/eslint-plugin-react](https://html-eslint.org/docs/react/getting-started) to enforce accessibility standards for React components.
|
|
@@ -2,7 +2,7 @@ import { PluginRules, RuleOptions } from "../eslintRules.mjs";
|
|
|
2
2
|
import { ConfigWithOverrides } from "../index.mjs";
|
|
3
3
|
//#region src/types/options/typescript.d.ts
|
|
4
4
|
type ConfigRules = PluginRules<'@typescript-eslint'>;
|
|
5
|
-
interface
|
|
5
|
+
interface TypescriptOptions extends ConfigWithOverrides<ConfigRules> {
|
|
6
6
|
/**
|
|
7
7
|
* Globs of files to allow running with the default project compiler options despite not being matched by the project service (_tsconfig.json_).
|
|
8
8
|
*
|
|
@@ -43,4 +43,4 @@ interface TypeScriptOptions extends ConfigWithOverrides<ConfigRules> {
|
|
|
43
43
|
typeDefinitionStyle?: RuleOptions<'@typescript-eslint/consistent-type-definitions'>;
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
|
-
export type {
|
|
46
|
+
export type { TypescriptOptions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shayanthenerd/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "A modern, flexible ESLint configuration for enforcing best practices and maintaining a consistent coding style",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eslint",
|
|
@@ -44,8 +44,15 @@
|
|
|
44
44
|
},
|
|
45
45
|
"nano-staged": {
|
|
46
46
|
"**/*.{json,yaml}!pnpm-lock.yaml": "pnpm format",
|
|
47
|
-
"pnpm-lock.yaml":
|
|
48
|
-
|
|
47
|
+
"pnpm-lock.yaml": [
|
|
48
|
+
"pnpm generate:types",
|
|
49
|
+
"pnpm generate:docs",
|
|
50
|
+
"git add src/types/eslint-schema.d.ts README.md"
|
|
51
|
+
],
|
|
52
|
+
"src/types/**/*.d.ts": [
|
|
53
|
+
"pnpm generate:docs",
|
|
54
|
+
"git add README.md"
|
|
55
|
+
],
|
|
49
56
|
"{**/*.ts,package.json}": "pnpm lint"
|
|
50
57
|
},
|
|
51
58
|
"dependencies": {
|