@bfra.me/eslint-config 0.37.0 → 0.39.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/lib/index.d.ts +57 -5
- package/lib/index.js +28 -2
- package/package.json +15 -14
- package/src/config.d.ts +1 -0
- package/src/configs/markdown.ts +2 -1
- package/src/configs/nextjs.ts +5 -0
- package/src/configs/typescript.ts +33 -3
- package/src/options.ts +18 -2
- package/src/rules.d.ts +38 -2
package/lib/index.d.ts
CHANGED
|
@@ -1710,6 +1710,26 @@ interface Rules {
|
|
|
1710
1710
|
* @see https://eslint.org/docs/latest/rules/eqeqeq
|
|
1711
1711
|
*/
|
|
1712
1712
|
'eqeqeq'?: Linter.RuleEntry<Eqeqeq>
|
|
1713
|
+
/**
|
|
1714
|
+
* Avoid using TypeScript's enums.
|
|
1715
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/enums.md
|
|
1716
|
+
*/
|
|
1717
|
+
'erasable-syntax-only/enums'?: Linter.RuleEntry<[]>
|
|
1718
|
+
/**
|
|
1719
|
+
* Avoid using TypeScript's import aliases.
|
|
1720
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/import-aliases.md
|
|
1721
|
+
*/
|
|
1722
|
+
'erasable-syntax-only/import-aliases'?: Linter.RuleEntry<[]>
|
|
1723
|
+
/**
|
|
1724
|
+
* Avoid using TypeScript's namespaces.
|
|
1725
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/namespaces.md
|
|
1726
|
+
*/
|
|
1727
|
+
'erasable-syntax-only/namespaces'?: Linter.RuleEntry<[]>
|
|
1728
|
+
/**
|
|
1729
|
+
* Avoid using TypeScript's class parameter properties.
|
|
1730
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/parameter-properties.md
|
|
1731
|
+
*/
|
|
1732
|
+
'erasable-syntax-only/parameter-properties'?: Linter.RuleEntry<[]>
|
|
1713
1733
|
/**
|
|
1714
1734
|
* require a `eslint-enable` comment for every `eslint-disable` comment
|
|
1715
1735
|
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
|
|
@@ -4555,6 +4575,11 @@ interface Rules {
|
|
|
4555
4575
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
4556
4576
|
*/
|
|
4557
4577
|
'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
|
|
4578
|
+
/**
|
|
4579
|
+
* Prevents dollar signs from being inserted as text nodes before expressions.
|
|
4580
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-dollar
|
|
4581
|
+
*/
|
|
4582
|
+
'react/jsx-dollar'?: Linter.RuleEntry<[]>
|
|
4558
4583
|
/**
|
|
4559
4584
|
* Enforces that the 'key' prop is placed before the spread prop in JSX elements.
|
|
4560
4585
|
* @see https://eslint-react.xyz/docs/rules/jsx-key-before-spread
|
|
@@ -4693,6 +4718,7 @@ interface Rules {
|
|
|
4693
4718
|
/**
|
|
4694
4719
|
* Disallow certain props on components.
|
|
4695
4720
|
* @see https://eslint-react.xyz/docs/rules/no-forbidden-props
|
|
4721
|
+
* @deprecated
|
|
4696
4722
|
*/
|
|
4697
4723
|
'react/no-forbidden-props'?: Linter.RuleEntry<ReactNoForbiddenProps>
|
|
4698
4724
|
/**
|
|
@@ -4814,7 +4840,7 @@ interface Rules {
|
|
|
4814
4840
|
* Prevents using referential-type values as default props in object destructuring.
|
|
4815
4841
|
* @see https://eslint-react.xyz/docs/rules/no-unstable-default-props
|
|
4816
4842
|
*/
|
|
4817
|
-
'react/no-unstable-default-props'?: Linter.RuleEntry<
|
|
4843
|
+
'react/no-unstable-default-props'?: Linter.RuleEntry<ReactNoUnstableDefaultProps>
|
|
4818
4844
|
/**
|
|
4819
4845
|
* Warns unused class component methods and properties.
|
|
4820
4846
|
* @see https://eslint-react.xyz/docs/rules/no-unused-class-component-members
|
|
@@ -6588,6 +6614,11 @@ interface Rules {
|
|
|
6588
6614
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-vi-mocked.md
|
|
6589
6615
|
*/
|
|
6590
6616
|
'vitest/prefer-vi-mocked'?: Linter.RuleEntry<[]>
|
|
6617
|
+
/**
|
|
6618
|
+
* ensure that every `expect.poll` call is awaited
|
|
6619
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-awaited-expect-poll.md
|
|
6620
|
+
*/
|
|
6621
|
+
'vitest/require-awaited-expect-poll'?: Linter.RuleEntry<[]>
|
|
6591
6622
|
/**
|
|
6592
6623
|
* require setup and teardown to be within a hook
|
|
6593
6624
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
@@ -15441,6 +15472,10 @@ type ReactNoForbiddenProps = []|[{
|
|
|
15441
15472
|
prop: string
|
|
15442
15473
|
})[]
|
|
15443
15474
|
}]
|
|
15475
|
+
// ----- react/no-unstable-default-props -----
|
|
15476
|
+
type ReactNoUnstableDefaultProps = []|[{
|
|
15477
|
+
safeDefaultProps?: string[]
|
|
15478
|
+
}]
|
|
15444
15479
|
// ----- react/no-useless-fragment -----
|
|
15445
15480
|
type ReactNoUselessFragment = []|[{
|
|
15446
15481
|
|
|
@@ -16107,7 +16142,8 @@ type VitestNoFocusedTests = []|[{
|
|
|
16107
16142
|
}]
|
|
16108
16143
|
// ----- vitest/no-hooks -----
|
|
16109
16144
|
type VitestNoHooks = []|[{
|
|
16110
|
-
|
|
16145
|
+
|
|
16146
|
+
allow?: ("beforeAll" | "beforeEach" | "afterAll" | "afterEach")[]
|
|
16111
16147
|
}]
|
|
16112
16148
|
// ----- vitest/no-large-snapshots -----
|
|
16113
16149
|
type VitestNoLargeSnapshots = []|[{
|
|
@@ -16477,6 +16513,7 @@ type ConfigNames =
|
|
|
16477
16513
|
| '@bfra.me/typescript/parser'
|
|
16478
16514
|
| '@bfra.me/typescript/rules'
|
|
16479
16515
|
| '@bfra.me/typescript/type-aware-rules'
|
|
16516
|
+
| '@bfra.me/typescript/erasable-syntax-only'
|
|
16480
16517
|
| '@bfra.me/unicorn'
|
|
16481
16518
|
| '@bfra.me/vitest/plugins'
|
|
16482
16519
|
| '@bfra.me/vitest'
|
|
@@ -16816,7 +16853,7 @@ declare function toml(options?: TomlOptions): Promise<Config[]>;
|
|
|
16816
16853
|
* - {@link OptionsTypeScriptParserOptions}: Options for the TypeScript parser
|
|
16817
16854
|
* - {@link OptionsTypeScriptWithTypes}: Options related to type-aware linting
|
|
16818
16855
|
*/
|
|
16819
|
-
type TypeScriptOptions = Flatten<OptionsFiles & OptionsOverrides & OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes>;
|
|
16856
|
+
type TypeScriptOptions = Flatten<OptionsFiles & OptionsOverrides & OptionsTypeScriptParserOptions & OptionsTypeScriptWithTypes & OptionsTypeScriptErasableSyntaxOnly>;
|
|
16820
16857
|
/**
|
|
16821
16858
|
* Generates a TypeScript ESLint configuration based on the provided options.
|
|
16822
16859
|
*
|
|
@@ -16924,6 +16961,21 @@ interface OptionsPerfectionist {
|
|
|
16924
16961
|
*/
|
|
16925
16962
|
sortImports?: boolean;
|
|
16926
16963
|
}
|
|
16964
|
+
/**
|
|
16965
|
+
* Provides an option to enable erasable syntax only rules in the ESLint configuration.
|
|
16966
|
+
* When `erasableSyntaxOnly` is set to `true`, the ESLint configuration will include
|
|
16967
|
+
* rules from the `eslint-plugin-erasable-syntax-only` plugin, which focuses on enforcing
|
|
16968
|
+
* syntax that can be safely removed without affecting the program's behavior.
|
|
16969
|
+
*/
|
|
16970
|
+
interface OptionsTypeScriptErasableSyntaxOnly {
|
|
16971
|
+
/**
|
|
16972
|
+
* Enable erasable syntax only rules.
|
|
16973
|
+
*
|
|
16974
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only
|
|
16975
|
+
* @default false
|
|
16976
|
+
*/
|
|
16977
|
+
erasableSyntaxOnly?: boolean;
|
|
16978
|
+
}
|
|
16927
16979
|
/**
|
|
16928
16980
|
* Provides options to configure the TypeScript parser and type-aware linting rules.
|
|
16929
16981
|
*
|
|
@@ -16975,7 +17027,7 @@ interface OptionsTypeScriptWithTypes {
|
|
|
16975
17027
|
/**
|
|
16976
17028
|
* Represents the options for configuring TypeScript support in the ESLint configuration.
|
|
16977
17029
|
*/
|
|
16978
|
-
type OptionsTypeScript = (OptionsTypeScriptParserOptions & OptionsOverrides) | (OptionsTypeScriptWithTypes & OptionsOverrides);
|
|
17030
|
+
type OptionsTypeScript = (OptionsTypeScriptParserOptions & OptionsOverrides & OptionsTypeScriptErasableSyntaxOnly) | (OptionsTypeScriptWithTypes & OptionsOverrides & OptionsTypeScriptErasableSyntaxOnly);
|
|
16979
17031
|
interface OptionsStylistic {
|
|
16980
17032
|
stylistic?: boolean | StylisticConfig;
|
|
16981
17033
|
}
|
|
@@ -17203,4 +17255,4 @@ declare const GLOB_EXCLUDE: string[];
|
|
|
17203
17255
|
|
|
17204
17256
|
declare const config: eslint_flat_config_utils.FlatConfigComposer<Config, ConfigNames>;
|
|
17205
17257
|
|
|
17206
|
-
export { type AstroOptions, type Config, type ConfigNames, type FallbackOptions, type Flatten, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CODE_IN_MARKDOWN_FILES, GLOB_EXCLUDE, GLOB_EXT_IN_MARKDOWN_FILES, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_FILES, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_FILES, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_PACKAGE_JSON_FILES, GLOB_RENOVATE_CONFIG, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TOML, GLOB_TOML_FILES, GLOB_TS, GLOB_TSX, GLOB_TS_CONFIG, GLOB_YAML, GLOB_YAML_FILES, type ImportsOptions, type JSDocOptions, type JavaScriptOptions, type JsoncOptions, type MarkdownOptions, type NextjsOptions, type Options, type OptionsFiles, type OptionsIsInEditor, type OptionsOverrides, type OptionsPerfectionist, type OptionsStylistic, type OptionsTypeScript, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PackageJsonOptions, type PerfectionistOptions, type PrettierOptions, type ReactOptions, type RegexpOptions, type Rules, type StylisticConfig, type StylisticOptions, type TomlOptions, type TypeScriptOptions, type UnicornOptions, type VitestOptions, type YamlOptions, astro, command, composeConfig, config, config as default, defineConfig, epilogue, eslintComments, fallback, gitignore, ignores, imports, isInEditor, isInGitLifecycle, javascript, jsdoc, jsonc, markdown, nextjs, node, packageJson, perfectionist, pnpm, prettier, react, regexp, sortPackageJson, sortRenovateConfig, sortTsconfig, stylistic, toml, typescript, unicorn, vitest, yaml };
|
|
17258
|
+
export { type AstroOptions, type Config, type ConfigNames, type FallbackOptions, type Flatten, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CODE_IN_MARKDOWN_FILES, GLOB_EXCLUDE, GLOB_EXT_IN_MARKDOWN_FILES, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSON_FILES, GLOB_JSX, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_FILES, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_PACKAGE_JSON_FILES, GLOB_RENOVATE_CONFIG, GLOB_SRC, GLOB_SRC_EXT, GLOB_TESTS, GLOB_TOML, GLOB_TOML_FILES, GLOB_TS, GLOB_TSX, GLOB_TS_CONFIG, GLOB_YAML, GLOB_YAML_FILES, type ImportsOptions, type JSDocOptions, type JavaScriptOptions, type JsoncOptions, type MarkdownOptions, type NextjsOptions, type Options, type OptionsFiles, type OptionsIsInEditor, type OptionsOverrides, type OptionsPerfectionist, type OptionsStylistic, type OptionsTypeScript, type OptionsTypeScriptErasableSyntaxOnly, type OptionsTypeScriptParserOptions, type OptionsTypeScriptWithTypes, type PackageJsonOptions, type PerfectionistOptions, type PrettierOptions, type ReactOptions, type RegexpOptions, type Rules, type StylisticConfig, type StylisticOptions, type TomlOptions, type TypeScriptOptions, type UnicornOptions, type VitestOptions, type YamlOptions, astro, command, composeConfig, config, config as default, defineConfig, epilogue, eslintComments, fallback, gitignore, ignores, imports, isInEditor, isInGitLifecycle, javascript, jsdoc, jsonc, markdown, nextjs, node, packageJson, perfectionist, pnpm, prettier, react, regexp, sortPackageJson, sortRenovateConfig, sortTsconfig, stylistic, toml, typescript, unicorn, vitest, yaml };
|
package/lib/index.js
CHANGED
|
@@ -105,7 +105,7 @@ var GLOB_EXCLUDE = [
|
|
|
105
105
|
import { fileURLToPath } from "url";
|
|
106
106
|
|
|
107
107
|
// package.json
|
|
108
|
-
var version = "0.
|
|
108
|
+
var version = "0.39.0";
|
|
109
109
|
|
|
110
110
|
// src/parsers/any-parser.ts
|
|
111
111
|
var lineBreakPattern = /\r\n|[\n\r\u2028\u2029]/u;
|
|
@@ -885,6 +885,11 @@ async function nextjs(options = {}) {
|
|
|
885
885
|
const pluginNextJs = await interopDefault(import("@next/eslint-plugin-next"));
|
|
886
886
|
function getRules(name) {
|
|
887
887
|
const rules = pluginNextJs.configs?.[name]?.rules;
|
|
888
|
+
if (!rules) {
|
|
889
|
+
throw new Error(
|
|
890
|
+
`[@bfra.me/eslint-config] No rules found for @next/eslint-plugin-next config: ${name}`
|
|
891
|
+
);
|
|
892
|
+
}
|
|
888
893
|
return normalizeRules(rules);
|
|
889
894
|
}
|
|
890
895
|
return [
|
|
@@ -1750,7 +1755,12 @@ var TypeAwareRules = {
|
|
|
1750
1755
|
"no-implied-eval": "off"
|
|
1751
1756
|
};
|
|
1752
1757
|
async function typescript(options = {}) {
|
|
1753
|
-
const {
|
|
1758
|
+
const {
|
|
1759
|
+
erasableSyntaxOnly = false,
|
|
1760
|
+
overrides = {},
|
|
1761
|
+
parserOptions = {},
|
|
1762
|
+
typeAware = { overrides: {} }
|
|
1763
|
+
} = options;
|
|
1754
1764
|
const files = options.files ?? [GLOB_TS, GLOB_TSX];
|
|
1755
1765
|
const typeAwareFiles = typeAware.files ?? [GLOB_TS, GLOB_TSX];
|
|
1756
1766
|
const typeAwareIgnores = typeAware.ignores ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS];
|
|
@@ -1872,6 +1882,22 @@ async function typescript(options = {}) {
|
|
|
1872
1882
|
ignores: typeAwareIgnores,
|
|
1873
1883
|
rules: { ...TypeAwareRules, ...typeAware?.overrides }
|
|
1874
1884
|
}
|
|
1885
|
+
] : [],
|
|
1886
|
+
...erasableSyntaxOnly ? [
|
|
1887
|
+
{
|
|
1888
|
+
name: "@bfra.me/typescript/erasable-syntax-only",
|
|
1889
|
+
plugins: {
|
|
1890
|
+
"erasable-syntax-only": await interopDefault(
|
|
1891
|
+
import("eslint-plugin-erasable-syntax-only")
|
|
1892
|
+
)
|
|
1893
|
+
},
|
|
1894
|
+
rules: {
|
|
1895
|
+
"erasable-syntax-only/namespaces": "error",
|
|
1896
|
+
"erasable-syntax-only/enums": "error",
|
|
1897
|
+
"erasable-syntax-only/import-aliases": "error",
|
|
1898
|
+
"erasable-syntax-only/parameter-properties": "error"
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1875
1901
|
] : []
|
|
1876
1902
|
];
|
|
1877
1903
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bfra.me/eslint-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "Shared ESLint configuration for bfra.me",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bfra.me",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@eslint-community/eslint-plugin-eslint-comments": "4.5.0",
|
|
41
|
-
"@eslint/markdown": "7.5.
|
|
41
|
+
"@eslint/markdown": "7.5.1",
|
|
42
42
|
"@stylistic/eslint-plugin": "5.5.0",
|
|
43
43
|
"eslint-config-flat-gitignore": "2.1.0",
|
|
44
44
|
"eslint-flat-config-utils": "2.1.4",
|
|
45
45
|
"eslint-merge-processors": "2.0.0",
|
|
46
46
|
"eslint-plugin-command": "3.3.1",
|
|
47
47
|
"eslint-plugin-import-x": "4.16.1",
|
|
48
|
-
"eslint-plugin-jsdoc": "61.1.
|
|
49
|
-
"eslint-plugin-json-schema-validator": "5.
|
|
48
|
+
"eslint-plugin-jsdoc": "61.1.12",
|
|
49
|
+
"eslint-plugin-json-schema-validator": "5.5.0",
|
|
50
50
|
"eslint-plugin-jsonc": "2.21.0",
|
|
51
51
|
"eslint-plugin-n": "17.23.1",
|
|
52
52
|
"eslint-plugin-perfectionist": "4.15.1",
|
|
@@ -55,26 +55,27 @@
|
|
|
55
55
|
"eslint-plugin-unicorn": "62.0.0",
|
|
56
56
|
"eslint-plugin-unused-imports": "4.3.0",
|
|
57
57
|
"eslint-plugin-yml": "1.19.0",
|
|
58
|
-
"globals": "16.
|
|
58
|
+
"globals": "16.5.0",
|
|
59
59
|
"is-in-ci": "2.0.0",
|
|
60
60
|
"local-pkg": "1.1.2",
|
|
61
61
|
"package-directory": "8.1.0",
|
|
62
62
|
"package-manager-detector": "1.5.0",
|
|
63
63
|
"sort-package-json": "3.4.0",
|
|
64
|
-
"typescript-eslint": "8.46.
|
|
64
|
+
"typescript-eslint": "8.46.4"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@eslint-react/eslint-plugin": "2.
|
|
67
|
+
"@eslint-react/eslint-plugin": "2.3.4",
|
|
68
68
|
"@eslint/config-inspector": "1.3.0",
|
|
69
69
|
"@eslint/core": "0.17.0",
|
|
70
|
-
"@next/eslint-plugin-next": "
|
|
70
|
+
"@next/eslint-plugin-next": "16.0.1",
|
|
71
71
|
"@types/eslint-config-prettier": "6.11.3",
|
|
72
|
-
"@typescript-eslint/types": "8.46.
|
|
73
|
-
"@vitest/eslint-plugin": "1.
|
|
72
|
+
"@typescript-eslint/types": "8.46.4",
|
|
73
|
+
"@vitest/eslint-plugin": "1.4.2",
|
|
74
74
|
"astro-eslint-parser": "1.2.2",
|
|
75
|
-
"eslint": "9.
|
|
75
|
+
"eslint": "9.39.1",
|
|
76
76
|
"eslint-config-prettier": "10.1.8",
|
|
77
|
-
"eslint-plugin-astro": "1.
|
|
77
|
+
"eslint-plugin-astro": "1.5.0",
|
|
78
|
+
"eslint-plugin-erasable-syntax-only": "0.4.0",
|
|
78
79
|
"eslint-plugin-node-dependencies": "1.2.0",
|
|
79
80
|
"eslint-plugin-pnpm": "1.3.0",
|
|
80
81
|
"eslint-plugin-prettier": "5.5.4",
|
|
@@ -83,13 +84,13 @@
|
|
|
83
84
|
"eslint-typegen": "2.3.0",
|
|
84
85
|
"tsup": "8.5.0",
|
|
85
86
|
"tsx": "4.20.6",
|
|
87
|
+
"@bfra.me/eslint-config": "0.39.0",
|
|
86
88
|
"@bfra.me/prettier-config": "0.16.1",
|
|
87
|
-
"@bfra.me/eslint-config": "0.37.0",
|
|
88
89
|
"@bfra.me/tsconfig": "0.12.0"
|
|
89
90
|
},
|
|
90
91
|
"peerDependencies": {
|
|
91
92
|
"@eslint-react/eslint-plugin": "^2.0.1",
|
|
92
|
-
"@next/eslint-plugin-next": "
|
|
93
|
+
"@next/eslint-plugin-next": ">=15.5.3",
|
|
93
94
|
"@vitest/eslint-plugin": "^1.1.21",
|
|
94
95
|
"astro-eslint-parser": "^1.2.2",
|
|
95
96
|
"eslint": "^9.38.0",
|
package/src/config.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export type ConfigNames =
|
|
|
85
85
|
| '@bfra.me/typescript/parser'
|
|
86
86
|
| '@bfra.me/typescript/rules'
|
|
87
87
|
| '@bfra.me/typescript/type-aware-rules'
|
|
88
|
+
| '@bfra.me/typescript/erasable-syntax-only'
|
|
88
89
|
| '@bfra.me/unicorn'
|
|
89
90
|
| '@bfra.me/vitest/plugins'
|
|
90
91
|
| '@bfra.me/vitest'
|
package/src/configs/markdown.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type {Plugin} from '@eslint/core'
|
|
1
2
|
import type {Config} from '../config'
|
|
2
3
|
import type {Flatten, OptionsFiles, OptionsOverrides} from '../options'
|
|
3
4
|
import {mergeProcessors, processorPassThrough} from 'eslint-merge-processors'
|
|
@@ -28,7 +29,7 @@ export async function markdown(options: MarkdownOptions = {}): Promise<Config[]>
|
|
|
28
29
|
{
|
|
29
30
|
name: '@bfra.me/markdown/plugin',
|
|
30
31
|
plugins: {
|
|
31
|
-
markdown,
|
|
32
|
+
markdown: markdown as unknown as Plugin,
|
|
32
33
|
},
|
|
33
34
|
},
|
|
34
35
|
{
|
package/src/configs/nextjs.ts
CHANGED
|
@@ -41,6 +41,11 @@ export async function nextjs(options: NextjsOptions = {}): Promise<Config[]> {
|
|
|
41
41
|
|
|
42
42
|
function getRules(name: keyof typeof pluginNextJs.configs) {
|
|
43
43
|
const rules = pluginNextJs.configs?.[name]?.rules
|
|
44
|
+
if (!rules) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
`[@bfra.me/eslint-config] No rules found for @next/eslint-plugin-next config: ${name}`,
|
|
47
|
+
)
|
|
48
|
+
}
|
|
44
49
|
return normalizeRules(rules)
|
|
45
50
|
}
|
|
46
51
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import type {Plugin} from '@eslint/core'
|
|
1
2
|
import type {Config} from '../config'
|
|
2
3
|
import type {
|
|
3
4
|
Flatten,
|
|
4
5
|
OptionsFiles,
|
|
5
6
|
OptionsOverrides,
|
|
7
|
+
OptionsTypeScriptErasableSyntaxOnly,
|
|
6
8
|
OptionsTypeScriptParserOptions,
|
|
7
9
|
OptionsTypeScriptWithTypes,
|
|
8
10
|
} from '../options'
|
|
@@ -87,7 +89,11 @@ const TypeAwareRules: Config['rules'] = {
|
|
|
87
89
|
* - {@link OptionsTypeScriptWithTypes}: Options related to type-aware linting
|
|
88
90
|
*/
|
|
89
91
|
export type TypeScriptOptions = Flatten<
|
|
90
|
-
OptionsFiles &
|
|
92
|
+
OptionsFiles &
|
|
93
|
+
OptionsOverrides &
|
|
94
|
+
OptionsTypeScriptParserOptions &
|
|
95
|
+
OptionsTypeScriptWithTypes &
|
|
96
|
+
OptionsTypeScriptErasableSyntaxOnly
|
|
91
97
|
>
|
|
92
98
|
|
|
93
99
|
/**
|
|
@@ -102,7 +108,12 @@ export type TypeScriptOptions = Flatten<
|
|
|
102
108
|
* @returns An array of ESLint configurations.
|
|
103
109
|
*/
|
|
104
110
|
export async function typescript(options: TypeScriptOptions = {}): Promise<Config[]> {
|
|
105
|
-
const {
|
|
111
|
+
const {
|
|
112
|
+
erasableSyntaxOnly = false,
|
|
113
|
+
overrides = {},
|
|
114
|
+
parserOptions = {},
|
|
115
|
+
typeAware = {overrides: {}},
|
|
116
|
+
} = options
|
|
106
117
|
const files = options.files ?? [GLOB_TS, GLOB_TSX]
|
|
107
118
|
const typeAwareFiles = typeAware.files ?? [GLOB_TS, GLOB_TSX]
|
|
108
119
|
const typeAwareIgnores = typeAware.ignores ?? [`${GLOB_MARKDOWN}/**`, GLOB_ASTRO_TS]
|
|
@@ -249,7 +260,26 @@ export async function typescript(options: TypeScriptOptions = {}): Promise<Confi
|
|
|
249
260
|
},
|
|
250
261
|
]
|
|
251
262
|
: []),
|
|
252
|
-
|
|
263
|
+
|
|
264
|
+
...(erasableSyntaxOnly
|
|
265
|
+
? [
|
|
266
|
+
{
|
|
267
|
+
name: '@bfra.me/typescript/erasable-syntax-only',
|
|
268
|
+
plugins: {
|
|
269
|
+
'erasable-syntax-only': (await interopDefault(
|
|
270
|
+
import('eslint-plugin-erasable-syntax-only'),
|
|
271
|
+
)) as unknown as Plugin,
|
|
272
|
+
},
|
|
273
|
+
rules: {
|
|
274
|
+
'erasable-syntax-only/namespaces': 'error',
|
|
275
|
+
'erasable-syntax-only/enums': 'error',
|
|
276
|
+
'erasable-syntax-only/import-aliases': 'error',
|
|
277
|
+
'erasable-syntax-only/parameter-properties': 'error',
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
]
|
|
281
|
+
: []),
|
|
282
|
+
] as Config[]
|
|
253
283
|
},
|
|
254
284
|
async missingList =>
|
|
255
285
|
fallback(missingList, {
|
package/src/options.ts
CHANGED
|
@@ -72,6 +72,22 @@ export interface OptionsPerfectionist {
|
|
|
72
72
|
sortImports?: boolean
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Provides an option to enable erasable syntax only rules in the ESLint configuration.
|
|
77
|
+
* When `erasableSyntaxOnly` is set to `true`, the ESLint configuration will include
|
|
78
|
+
* rules from the `eslint-plugin-erasable-syntax-only` plugin, which focuses on enforcing
|
|
79
|
+
* syntax that can be safely removed without affecting the program's behavior.
|
|
80
|
+
*/
|
|
81
|
+
export interface OptionsTypeScriptErasableSyntaxOnly {
|
|
82
|
+
/**
|
|
83
|
+
* Enable erasable syntax only rules.
|
|
84
|
+
*
|
|
85
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
erasableSyntaxOnly?: boolean
|
|
89
|
+
}
|
|
90
|
+
|
|
75
91
|
/**
|
|
76
92
|
* Provides options to configure the TypeScript parser and type-aware linting rules.
|
|
77
93
|
*
|
|
@@ -129,8 +145,8 @@ export interface OptionsTypeScriptWithTypes {
|
|
|
129
145
|
* Represents the options for configuring TypeScript support in the ESLint configuration.
|
|
130
146
|
*/
|
|
131
147
|
export type OptionsTypeScript =
|
|
132
|
-
| (OptionsTypeScriptParserOptions & OptionsOverrides)
|
|
133
|
-
| (OptionsTypeScriptWithTypes & OptionsOverrides)
|
|
148
|
+
| (OptionsTypeScriptParserOptions & OptionsOverrides & OptionsTypeScriptErasableSyntaxOnly)
|
|
149
|
+
| (OptionsTypeScriptWithTypes & OptionsOverrides & OptionsTypeScriptErasableSyntaxOnly)
|
|
134
150
|
|
|
135
151
|
export interface OptionsStylistic {
|
|
136
152
|
stylistic?: boolean | StylisticConfig
|
package/src/rules.d.ts
CHANGED
|
@@ -1701,6 +1701,26 @@ export interface Rules {
|
|
|
1701
1701
|
* @see https://eslint.org/docs/latest/rules/eqeqeq
|
|
1702
1702
|
*/
|
|
1703
1703
|
'eqeqeq'?: Linter.RuleEntry<Eqeqeq>
|
|
1704
|
+
/**
|
|
1705
|
+
* Avoid using TypeScript's enums.
|
|
1706
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/enums.md
|
|
1707
|
+
*/
|
|
1708
|
+
'erasable-syntax-only/enums'?: Linter.RuleEntry<[]>
|
|
1709
|
+
/**
|
|
1710
|
+
* Avoid using TypeScript's import aliases.
|
|
1711
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/import-aliases.md
|
|
1712
|
+
*/
|
|
1713
|
+
'erasable-syntax-only/import-aliases'?: Linter.RuleEntry<[]>
|
|
1714
|
+
/**
|
|
1715
|
+
* Avoid using TypeScript's namespaces.
|
|
1716
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/namespaces.md
|
|
1717
|
+
*/
|
|
1718
|
+
'erasable-syntax-only/namespaces'?: Linter.RuleEntry<[]>
|
|
1719
|
+
/**
|
|
1720
|
+
* Avoid using TypeScript's class parameter properties.
|
|
1721
|
+
* @see https://github.com/JoshuaKGoldberg/eslint-plugin-erasable-syntax-only/blob/main/docs/rules/parameter-properties.md
|
|
1722
|
+
*/
|
|
1723
|
+
'erasable-syntax-only/parameter-properties'?: Linter.RuleEntry<[]>
|
|
1704
1724
|
/**
|
|
1705
1725
|
* require a `eslint-enable` comment for every `eslint-disable` comment
|
|
1706
1726
|
* @see https://eslint-community.github.io/eslint-plugin-eslint-comments/rules/disable-enable-pair.html
|
|
@@ -4546,6 +4566,11 @@ export interface Rules {
|
|
|
4546
4566
|
* @see https://eslint-react.xyz/docs/rules/web-api-no-leaked-timeout
|
|
4547
4567
|
*/
|
|
4548
4568
|
'react-web-api/no-leaked-timeout'?: Linter.RuleEntry<[]>
|
|
4569
|
+
/**
|
|
4570
|
+
* Prevents dollar signs from being inserted as text nodes before expressions.
|
|
4571
|
+
* @see https://eslint-react.xyz/docs/rules/jsx-dollar
|
|
4572
|
+
*/
|
|
4573
|
+
'react/jsx-dollar'?: Linter.RuleEntry<[]>
|
|
4549
4574
|
/**
|
|
4550
4575
|
* Enforces that the 'key' prop is placed before the spread prop in JSX elements.
|
|
4551
4576
|
* @see https://eslint-react.xyz/docs/rules/jsx-key-before-spread
|
|
@@ -4684,6 +4709,7 @@ export interface Rules {
|
|
|
4684
4709
|
/**
|
|
4685
4710
|
* Disallow certain props on components.
|
|
4686
4711
|
* @see https://eslint-react.xyz/docs/rules/no-forbidden-props
|
|
4712
|
+
* @deprecated
|
|
4687
4713
|
*/
|
|
4688
4714
|
'react/no-forbidden-props'?: Linter.RuleEntry<ReactNoForbiddenProps>
|
|
4689
4715
|
/**
|
|
@@ -4805,7 +4831,7 @@ export interface Rules {
|
|
|
4805
4831
|
* Prevents using referential-type values as default props in object destructuring.
|
|
4806
4832
|
* @see https://eslint-react.xyz/docs/rules/no-unstable-default-props
|
|
4807
4833
|
*/
|
|
4808
|
-
'react/no-unstable-default-props'?: Linter.RuleEntry<
|
|
4834
|
+
'react/no-unstable-default-props'?: Linter.RuleEntry<ReactNoUnstableDefaultProps>
|
|
4809
4835
|
/**
|
|
4810
4836
|
* Warns unused class component methods and properties.
|
|
4811
4837
|
* @see https://eslint-react.xyz/docs/rules/no-unused-class-component-members
|
|
@@ -6579,6 +6605,11 @@ export interface Rules {
|
|
|
6579
6605
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/prefer-vi-mocked.md
|
|
6580
6606
|
*/
|
|
6581
6607
|
'vitest/prefer-vi-mocked'?: Linter.RuleEntry<[]>
|
|
6608
|
+
/**
|
|
6609
|
+
* ensure that every `expect.poll` call is awaited
|
|
6610
|
+
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-awaited-expect-poll.md
|
|
6611
|
+
*/
|
|
6612
|
+
'vitest/require-awaited-expect-poll'?: Linter.RuleEntry<[]>
|
|
6582
6613
|
/**
|
|
6583
6614
|
* require setup and teardown to be within a hook
|
|
6584
6615
|
* @see https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/require-hook.md
|
|
@@ -15432,6 +15463,10 @@ type ReactNoForbiddenProps = []|[{
|
|
|
15432
15463
|
prop: string
|
|
15433
15464
|
})[]
|
|
15434
15465
|
}]
|
|
15466
|
+
// ----- react/no-unstable-default-props -----
|
|
15467
|
+
type ReactNoUnstableDefaultProps = []|[{
|
|
15468
|
+
safeDefaultProps?: string[]
|
|
15469
|
+
}]
|
|
15435
15470
|
// ----- react/no-useless-fragment -----
|
|
15436
15471
|
type ReactNoUselessFragment = []|[{
|
|
15437
15472
|
|
|
@@ -16098,7 +16133,8 @@ type VitestNoFocusedTests = []|[{
|
|
|
16098
16133
|
}]
|
|
16099
16134
|
// ----- vitest/no-hooks -----
|
|
16100
16135
|
type VitestNoHooks = []|[{
|
|
16101
|
-
|
|
16136
|
+
|
|
16137
|
+
allow?: ("beforeAll" | "beforeEach" | "afterAll" | "afterEach")[]
|
|
16102
16138
|
}]
|
|
16103
16139
|
// ----- vitest/no-large-snapshots -----
|
|
16104
16140
|
type VitestNoLargeSnapshots = []|[{
|