exadev-eslint-config 3.0.0 → 3.0.1
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 +6 -1
- package/dist/index.cjs +22 -3
- package/dist/index.js +22 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,10 @@ export default defineConfig(
|
|
|
42
42
|
|
|
43
43
|
**Remove your own `plugins: { '@stylistic': ... }` registration too.** The default export bundles [`@stylistic/eslint-plugin`](https://eslint.style) (see [Stylistic comment, class-member and JSX rules](#stylistic-comment-class-member-and-jsx-rules)) and registers it under the `@stylistic` namespace itself, so a consumer block registering its own copy of the plugin (a different version resolved from elsewhere in the lockfile, or a duplicated install) makes ESLint throw `Config: Key "plugins": Cannot redefine plugin "@stylistic".` at config load, the identical flat-config restriction as the typescript-eslint case above. Registering the very same instance is harmless, but the robust migration is to drop the registration entirely: configure any further `@stylistic/*` rules directly in your own `rules` block, since this package's block already registers the plugin for every JS/TS and JSX file.
|
|
44
44
|
|
|
45
|
+
**Your own blocks need no `plugins: { exadev }` and no `files`.** `exadevConfig()` registers the `exadev` plugin for every file it lints, so a block placed after it that sets an `exadev/*` rule written for JavaScript and TypeScript, such as `{ rules: { 'exadev/barrel-policy': ['error', { mode: 'siblings' }] } }`, loads even though it also applies to `tsconfig.json`, other JSON files and Markdown, and a rule that inspects JavaScript or TypeScript syntax leaves those files alone. The JSON and Markdown rules (`package-json-key-order`, `markdown-required-heading`, the [workspace architecture](#workspace-architecture) and [Turbo](#turbo) rules) are the exception: ESLint refuses to enable a rule for a language it does not declare, so a block that sets one needs the `files` of the kind of file it reads, which its preset already supplies.
|
|
46
|
+
|
|
47
|
+
**Rules from other plugins are different.** `@typescript-eslint/*`, `@stylistic/*`, `jsdoc/*`, `unicorn/*` and the rest are registered only for JavaScript and TypeScript files, so a block of your own that sets one needs `files: ['**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}']`; without it ESLint fails at config load with `could not find plugin` as soon as the block also applies to a JSON or Markdown file.
|
|
48
|
+
|
|
45
49
|
### What the default export includes
|
|
46
50
|
|
|
47
51
|
**typescript-eslint presets:**
|
|
@@ -1747,6 +1751,7 @@ pnpm build
|
|
|
1747
1751
|
- `tryResolveJsonPlugin` and `requireJsonPlugin` are the silent and the throwing resolution paths, the second naming the feature that needs the peer and the install command.
|
|
1748
1752
|
- `buildJsonLanguageBlock` assembles the `exadev` and `json` plugin registration for a `files` list under `json/json` or `json/jsonc`; the `json/jsonc` form also admits trailing commas, matching the JSONC config in [`src/json-canonical.ts`](src/json-canonical.ts). `JSONC_FILE_GLOBS` (`tsconfig*.json`, `turbo.json`, `*.jsonc`) lists the files that carry comments, so a rule targeting them must be wired under `json/jsonc`, and a rule meant for both languages declares both in `meta.languages`.
|
|
1749
1753
|
- `buildPackageJsonKeyOrderConfig` and `buildWorkspaceArchitectureConfig` are built on it; a new JSON rule family follows the same shape, taking its tri-state `enabled` option from `exadevConfig` and choosing `requireJsonPlugin` (forced on) or `tryResolveJsonPlugin` (auto-detected).
|
|
1754
|
+
- [`src/rules/estree-source.ts`](src/rules/estree-source.ts) holds `isEstreeSource`, the first check of every rule that reads JavaScript or TypeScript syntax (scope analysis, parser services, JSX): such a rule returns no listeners for a JSON, JSONC or Markdown file, which an unscoped block of a consumer's own can hand it. A rule that reads only the filename needs no such check.
|
|
1750
1755
|
- [`src/rules/file-scope.ts`](src/rules/file-scope.ts) lets a rule scope itself by filename, so it still behaves when a consumer wires it onto a wider `files` list.
|
|
1751
1756
|
- `createFileScope(globs)` returns a `(filename, cwd) => boolean` matching the file relative to `cwd` with minimatch (a leading `!` excludes, wildcards never matching dot-prefixed names). A file outside `cwd` (its relative path starts with `..`) is never in scope, whatever the patterns. Build it once per `create()`.
|
|
1752
1757
|
- `fileGlobsSchema` and `readFileGlobs` are the option schema and runtime validator for a glob list; a list needs at least one include, may not repeat a glob, and every glob must compile in minimatch.
|
|
@@ -1769,7 +1774,7 @@ pnpm build
|
|
|
1769
1774
|
- [`src/rules/run-tracker.ts`](src/rules/run-tracker.ts) decides which lint carries a finding that belongs to a set of files rather than to one, so `require-compiler-options` reports once per run; it reads run boundaries from the order of the lints, as [Compiler options](#compiler-options) describes.
|
|
1770
1775
|
- [`src/rules/tsconfig-attribution.ts`](src/rules/tsconfig-attribution.ts) works out which tsconfig governs a linted file, attributing a program with no tsconfig to the one the file was last linted under while that tsconfig still lists it.
|
|
1771
1776
|
- [`src/create-config.ts`](src/create-config.ts) is config assembly's single source of truth.
|
|
1772
|
-
- `exadevConfig(options)` concatenates, in order: `buildGitignoreConfig`, `recommendedTypeChecked`, `jsdocAndTsdoc`, `jsonCanonicalConfig`, `stylisticCommentsConfig`, `buildReactConfig`, `buildNextjsConfig`, `buildPackageJsonKeyOrderConfig` (each tri-state builder fed its matching option), `buildWorkspaceArchitectureConfig` (only when `workspaceArchitecture` is given; there is no auto-detected default), `buildTurboConfig` (only when `turbo` is given, likewise), `buildImportPolicyConfig` (only when `importPolicies` is given, likewise), `buildPureModulesConfig` (only when `pureModules` is given, likewise), `buildTestHygieneConfig` (only when `testHygiene` is given, likewise), `buildMarkdownHeadingsConfig` (only when `markdownHeadings` is given, likewise), `buildAgentSkillsConfig` (tri-state, placed after the headings block so that a SKILL.md stays YAML whatever format `markdownHeadings` sets), and `buildToolingWiringConfig` (only when `toolingWiring` is given, likewise).
|
|
1777
|
+
- `exadevConfig(options)` concatenates, in order: `buildGitignoreConfig`, a block that registers the `exadev` plugin with no `files`, `ignores` or `rules` (so a consumer's unscoped `exadev/*` rule resolves in every language the later blocks lint), `recommendedTypeChecked`, `jsdocAndTsdoc`, `jsonCanonicalConfig`, `stylisticCommentsConfig`, `buildReactConfig`, `buildNextjsConfig`, `buildPackageJsonKeyOrderConfig` (each tri-state builder fed its matching option), `buildWorkspaceArchitectureConfig` (only when `workspaceArchitecture` is given; there is no auto-detected default), `buildTurboConfig` (only when `turbo` is given, likewise), `buildImportPolicyConfig` (only when `importPolicies` is given, likewise), `buildPureModulesConfig` (only when `pureModules` is given, likewise), `buildTestHygieneConfig` (only when `testHygiene` is given, likewise), `buildMarkdownHeadingsConfig` (only when `markdownHeadings` is given, likewise), `buildAgentSkillsConfig` (tri-state, placed after the headings block so that a SKILL.md stays YAML whatever format `markdownHeadings` sets), and `buildToolingWiringConfig` (only when `toolingWiring` is given, likewise).
|
|
1773
1778
|
- `defaultConfig` is `exadevConfig()` evaluated once, eagerly, at module load.
|
|
1774
1779
|
- [`src/robustness-rules.ts`](src/robustness-rules.ts) holds `UNTYPED_ROBUSTNESS_RULES`, the core ESLint rules that need no type information, spread into both `plugin.configs.recommended` and the type-checked block so the two cannot drift apart.
|
|
1775
1780
|
- [`src/stylistic-comments.ts`](src/stylistic-comments.ts) builds `stylisticCommentsConfig`: the hand-picked `@stylistic/eslint-plugin` rules plus this package's own `exadev/multiline-comment-style` and `exadev/prefer-doc-comment`, in two blocks (one scoped to every JS/TS file, one scoped to JSX files only for the three JSX-specific rules). See [Stylistic comment, class-member and JSX rules](#stylistic-comment-class-member-and-jsx-rules).
|
package/dist/index.cjs
CHANGED
|
@@ -485,7 +485,7 @@ function buildOptionalPluginConfig(preset, options = {}) {
|
|
|
485
485
|
}
|
|
486
486
|
//#endregion
|
|
487
487
|
//#region package.json
|
|
488
|
-
var version = "3.0.
|
|
488
|
+
var version = "3.0.1";
|
|
489
489
|
//#endregion
|
|
490
490
|
//#region src/react.ts
|
|
491
491
|
/**
|
|
@@ -4086,6 +4086,14 @@ function asIdentifierName(name) {
|
|
|
4086
4086
|
return name;
|
|
4087
4087
|
}
|
|
4088
4088
|
//#endregion
|
|
4089
|
+
//#region src/rules/estree-source.ts
|
|
4090
|
+
/**
|
|
4091
|
+
* Whether the file under lint was parsed to an ESTree `Program`, the tree every rule that reads JavaScript or TypeScript syntax is written against. A rule that is wired onto a block with no `files` (the documented unscoped override placed after the shared config) is also handed the JSON, JSONC and Markdown files the shared config lints, whose source code objects have a different root and no scope manager or parser services; such a rule starts with `if (!isEstreeSource(context.sourceCode)) return {};` after reading its options, so a file of another language is left alone instead of crashing the run.
|
|
4092
|
+
*/
|
|
4093
|
+
function isEstreeSource(sourceCode) {
|
|
4094
|
+
return sourceCode.ast.type === "Program";
|
|
4095
|
+
}
|
|
4096
|
+
//#endregion
|
|
4089
4097
|
//#region src/rules/no-array-isarray-mutation.ts
|
|
4090
4098
|
const MUTATING_INSERT_METHODS$1 = /* @__PURE__ */ new Set([
|
|
4091
4099
|
"push",
|
|
@@ -4116,6 +4124,7 @@ const noArrayIsArrayMutation = createRule$18({
|
|
|
4116
4124
|
},
|
|
4117
4125
|
defaultOptions: [],
|
|
4118
4126
|
create(context) {
|
|
4127
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
4119
4128
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
4120
4129
|
const checker = services.program.getTypeChecker();
|
|
4121
4130
|
function declarationHasReadonlyArrayConstituent(declarationNode) {
|
|
@@ -4810,6 +4819,7 @@ const noEnumNumberWidening = _typescript_eslint_utils.ESLintUtils.RuleCreator((n
|
|
|
4810
4819
|
defaultOptions: []
|
|
4811
4820
|
},
|
|
4812
4821
|
create(context) {
|
|
4822
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
4813
4823
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
4814
4824
|
const checker = services.program.getTypeChecker();
|
|
4815
4825
|
function checkNode(expression) {
|
|
@@ -4858,6 +4868,7 @@ const noEnumReverseLookupWidening = _typescript_eslint_utils.ESLintUtils.RuleCre
|
|
|
4858
4868
|
defaultOptions: []
|
|
4859
4869
|
},
|
|
4860
4870
|
create(context) {
|
|
4871
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
4861
4872
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
4862
4873
|
const checker = services.program.getTypeChecker();
|
|
4863
4874
|
return { MemberExpression(node) {
|
|
@@ -4981,7 +4992,7 @@ const noExternalMemberJsxTag = _typescript_eslint_utils.ESLintUtils.RuleCreator(
|
|
|
4981
4992
|
create(context, [options]) {
|
|
4982
4993
|
const { allowSource, allowTags } = readNoExternalMemberJsxTagOptions(options);
|
|
4983
4994
|
const { sourceCode } = context;
|
|
4984
|
-
if (hasUseClientDirective(sourceCode.ast)) return {};
|
|
4995
|
+
if (!isEstreeSource(sourceCode) || hasUseClientDirective(sourceCode.ast)) return {};
|
|
4985
4996
|
return { JSXOpeningElement(node) {
|
|
4986
4997
|
if (node.name.type !== _typescript_eslint_utils.AST_NODE_TYPES.JSXMemberExpression) return;
|
|
4987
4998
|
const tag = sourceCode.getText(node.name);
|
|
@@ -5605,6 +5616,7 @@ const noMapInstanceofMutation = createRule$16({
|
|
|
5605
5616
|
},
|
|
5606
5617
|
defaultOptions: [],
|
|
5607
5618
|
create(context) {
|
|
5619
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
5608
5620
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
5609
5621
|
const checker = services.program.getTypeChecker();
|
|
5610
5622
|
function declarationHasReadonlyMapConstituent(declarationNode) {
|
|
@@ -6107,7 +6119,7 @@ const noNonSerialisableServerProp = createRule$14({
|
|
|
6107
6119
|
create(context, [options]) {
|
|
6108
6120
|
const { names, allowElements } = readNoNonSerialisableServerPropOptions(options);
|
|
6109
6121
|
const { sourceCode } = context;
|
|
6110
|
-
if (hasUseClientDirective(sourceCode.ast)) return {};
|
|
6122
|
+
if (!isEstreeSource(sourceCode) || hasUseClientDirective(sourceCode.ast)) return {};
|
|
6111
6123
|
return { JSXAttribute(node) {
|
|
6112
6124
|
if (node.name.type !== _typescript_eslint_utils.AST_NODE_TYPES.JSXIdentifier || !names.has(node.name.name)) return;
|
|
6113
6125
|
if (node.value?.type !== _typescript_eslint_utils.AST_NODE_TYPES.JSXExpressionContainer || node.value.expression.type === _typescript_eslint_utils.AST_NODE_TYPES.JSXEmptyExpression) return;
|
|
@@ -6484,6 +6496,7 @@ const noPointlessReassignment = {
|
|
|
6484
6496
|
messages: { pointlessReassignment: "Pointless reassignment: '{{ name }}' is just an alias for '{{ value }}'. Use the original directly." }
|
|
6485
6497
|
},
|
|
6486
6498
|
create(context) {
|
|
6499
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
6487
6500
|
const moduleScope = findTopLevelScope(context.sourceCode.getScope(context.sourceCode.ast));
|
|
6488
6501
|
return { VariableDeclarator(node) {
|
|
6489
6502
|
if (node.id.type !== "Identifier" || node.init?.type !== "Identifier" || node.id.name.startsWith("_")) return;
|
|
@@ -6550,6 +6563,7 @@ const noSetInstanceofMutation = createRule$11({
|
|
|
6550
6563
|
},
|
|
6551
6564
|
defaultOptions: [],
|
|
6552
6565
|
create(context) {
|
|
6566
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
6553
6567
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
6554
6568
|
const checker = services.program.getTypeChecker();
|
|
6555
6569
|
function declarationHasReadonlySetConstituent(declarationNode) {
|
|
@@ -7500,6 +7514,7 @@ const preferNumericSortCompare = createRule$10({
|
|
|
7500
7514
|
defaultOptions: []
|
|
7501
7515
|
},
|
|
7502
7516
|
create(context) {
|
|
7517
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
7503
7518
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
7504
7519
|
const checker = services.program.getTypeChecker();
|
|
7505
7520
|
return { CallExpression(node) {
|
|
@@ -7655,6 +7670,7 @@ const preferReadonlyObjectParam = createRule$8({
|
|
|
7655
7670
|
defaultOptions: []
|
|
7656
7671
|
},
|
|
7657
7672
|
create(context) {
|
|
7673
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
7658
7674
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
7659
7675
|
const checker = services.program.getTypeChecker();
|
|
7660
7676
|
function checkParam(param) {
|
|
@@ -8566,6 +8582,7 @@ const requireCompilerOptions = createRule$5({
|
|
|
8566
8582
|
create(context, [options]) {
|
|
8567
8583
|
const requirements = readCompilerOptionRequirements(options);
|
|
8568
8584
|
if (requirements.length === 0) return {};
|
|
8585
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
8569
8586
|
const { program } = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
8570
8587
|
const signature = JSON.stringify(requirements.map((requirement) => [requirement.name, requirement.spelled]));
|
|
8571
8588
|
return { Program(node) {
|
|
@@ -9023,6 +9040,7 @@ const scopedFirstParameter = _typescript_eslint_utils.ESLintUtils.RuleCreator((n
|
|
|
9023
9040
|
create(context, [options]) {
|
|
9024
9041
|
const { interfaces, name: requiredName, type: requiredType } = readScopedFirstParameterOptions(options);
|
|
9025
9042
|
const { sourceCode } = context;
|
|
9043
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
9026
9044
|
const services = _typescript_eslint_utils.ESLintUtils.getParserServices(context);
|
|
9027
9045
|
const checker = services.program.getTypeChecker();
|
|
9028
9046
|
const checkMembers = (owner, members) => {
|
|
@@ -12182,6 +12200,7 @@ function exadevConfig(options = {}) {
|
|
|
12182
12200
|
const gitignore = buildGitignoreConfig({ enabled: options.gitignore });
|
|
12183
12201
|
return toPublicConfigArray([
|
|
12184
12202
|
...gitignore,
|
|
12203
|
+
{ plugins: { exadev: plugin } },
|
|
12185
12204
|
...recommendedTypeChecked,
|
|
12186
12205
|
...jsdocAndTsdoc,
|
|
12187
12206
|
...jsonCanonicalConfig,
|
package/dist/index.js
CHANGED
|
@@ -450,7 +450,7 @@ function buildOptionalPluginConfig(preset, options = {}) {
|
|
|
450
450
|
}
|
|
451
451
|
//#endregion
|
|
452
452
|
//#region package.json
|
|
453
|
-
var version = "3.0.
|
|
453
|
+
var version = "3.0.1";
|
|
454
454
|
//#endregion
|
|
455
455
|
//#region src/react.ts
|
|
456
456
|
/**
|
|
@@ -4051,6 +4051,14 @@ function asIdentifierName(name) {
|
|
|
4051
4051
|
return name;
|
|
4052
4052
|
}
|
|
4053
4053
|
//#endregion
|
|
4054
|
+
//#region src/rules/estree-source.ts
|
|
4055
|
+
/**
|
|
4056
|
+
* Whether the file under lint was parsed to an ESTree `Program`, the tree every rule that reads JavaScript or TypeScript syntax is written against. A rule that is wired onto a block with no `files` (the documented unscoped override placed after the shared config) is also handed the JSON, JSONC and Markdown files the shared config lints, whose source code objects have a different root and no scope manager or parser services; such a rule starts with `if (!isEstreeSource(context.sourceCode)) return {};` after reading its options, so a file of another language is left alone instead of crashing the run.
|
|
4057
|
+
*/
|
|
4058
|
+
function isEstreeSource(sourceCode) {
|
|
4059
|
+
return sourceCode.ast.type === "Program";
|
|
4060
|
+
}
|
|
4061
|
+
//#endregion
|
|
4054
4062
|
//#region src/rules/no-array-isarray-mutation.ts
|
|
4055
4063
|
const MUTATING_INSERT_METHODS$1 = /* @__PURE__ */ new Set([
|
|
4056
4064
|
"push",
|
|
@@ -4081,6 +4089,7 @@ const noArrayIsArrayMutation = createRule$18({
|
|
|
4081
4089
|
},
|
|
4082
4090
|
defaultOptions: [],
|
|
4083
4091
|
create(context) {
|
|
4092
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
4084
4093
|
const services = ESLintUtils.getParserServices(context);
|
|
4085
4094
|
const checker = services.program.getTypeChecker();
|
|
4086
4095
|
function declarationHasReadonlyArrayConstituent(declarationNode) {
|
|
@@ -4775,6 +4784,7 @@ const noEnumNumberWidening = ESLintUtils.RuleCreator((name) => `https://github.c
|
|
|
4775
4784
|
defaultOptions: []
|
|
4776
4785
|
},
|
|
4777
4786
|
create(context) {
|
|
4787
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
4778
4788
|
const services = ESLintUtils.getParserServices(context);
|
|
4779
4789
|
const checker = services.program.getTypeChecker();
|
|
4780
4790
|
function checkNode(expression) {
|
|
@@ -4823,6 +4833,7 @@ const noEnumReverseLookupWidening = ESLintUtils.RuleCreator((name) => `https://g
|
|
|
4823
4833
|
defaultOptions: []
|
|
4824
4834
|
},
|
|
4825
4835
|
create(context) {
|
|
4836
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
4826
4837
|
const services = ESLintUtils.getParserServices(context);
|
|
4827
4838
|
const checker = services.program.getTypeChecker();
|
|
4828
4839
|
return { MemberExpression(node) {
|
|
@@ -4946,7 +4957,7 @@ const noExternalMemberJsxTag = ESLintUtils.RuleCreator((name) => `https://github
|
|
|
4946
4957
|
create(context, [options]) {
|
|
4947
4958
|
const { allowSource, allowTags } = readNoExternalMemberJsxTagOptions(options);
|
|
4948
4959
|
const { sourceCode } = context;
|
|
4949
|
-
if (hasUseClientDirective(sourceCode.ast)) return {};
|
|
4960
|
+
if (!isEstreeSource(sourceCode) || hasUseClientDirective(sourceCode.ast)) return {};
|
|
4950
4961
|
return { JSXOpeningElement(node) {
|
|
4951
4962
|
if (node.name.type !== AST_NODE_TYPES.JSXMemberExpression) return;
|
|
4952
4963
|
const tag = sourceCode.getText(node.name);
|
|
@@ -5570,6 +5581,7 @@ const noMapInstanceofMutation = createRule$16({
|
|
|
5570
5581
|
},
|
|
5571
5582
|
defaultOptions: [],
|
|
5572
5583
|
create(context) {
|
|
5584
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
5573
5585
|
const services = ESLintUtils.getParserServices(context);
|
|
5574
5586
|
const checker = services.program.getTypeChecker();
|
|
5575
5587
|
function declarationHasReadonlyMapConstituent(declarationNode) {
|
|
@@ -6072,7 +6084,7 @@ const noNonSerialisableServerProp = createRule$14({
|
|
|
6072
6084
|
create(context, [options]) {
|
|
6073
6085
|
const { names, allowElements } = readNoNonSerialisableServerPropOptions(options);
|
|
6074
6086
|
const { sourceCode } = context;
|
|
6075
|
-
if (hasUseClientDirective(sourceCode.ast)) return {};
|
|
6087
|
+
if (!isEstreeSource(sourceCode) || hasUseClientDirective(sourceCode.ast)) return {};
|
|
6076
6088
|
return { JSXAttribute(node) {
|
|
6077
6089
|
if (node.name.type !== AST_NODE_TYPES.JSXIdentifier || !names.has(node.name.name)) return;
|
|
6078
6090
|
if (node.value?.type !== AST_NODE_TYPES.JSXExpressionContainer || node.value.expression.type === AST_NODE_TYPES.JSXEmptyExpression) return;
|
|
@@ -6449,6 +6461,7 @@ const noPointlessReassignment = {
|
|
|
6449
6461
|
messages: { pointlessReassignment: "Pointless reassignment: '{{ name }}' is just an alias for '{{ value }}'. Use the original directly." }
|
|
6450
6462
|
},
|
|
6451
6463
|
create(context) {
|
|
6464
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
6452
6465
|
const moduleScope = findTopLevelScope(context.sourceCode.getScope(context.sourceCode.ast));
|
|
6453
6466
|
return { VariableDeclarator(node) {
|
|
6454
6467
|
if (node.id.type !== "Identifier" || node.init?.type !== "Identifier" || node.id.name.startsWith("_")) return;
|
|
@@ -6515,6 +6528,7 @@ const noSetInstanceofMutation = createRule$11({
|
|
|
6515
6528
|
},
|
|
6516
6529
|
defaultOptions: [],
|
|
6517
6530
|
create(context) {
|
|
6531
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
6518
6532
|
const services = ESLintUtils.getParserServices(context);
|
|
6519
6533
|
const checker = services.program.getTypeChecker();
|
|
6520
6534
|
function declarationHasReadonlySetConstituent(declarationNode) {
|
|
@@ -7465,6 +7479,7 @@ const preferNumericSortCompare = createRule$10({
|
|
|
7465
7479
|
defaultOptions: []
|
|
7466
7480
|
},
|
|
7467
7481
|
create(context) {
|
|
7482
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
7468
7483
|
const services = ESLintUtils.getParserServices(context);
|
|
7469
7484
|
const checker = services.program.getTypeChecker();
|
|
7470
7485
|
return { CallExpression(node) {
|
|
@@ -7620,6 +7635,7 @@ const preferReadonlyObjectParam = createRule$8({
|
|
|
7620
7635
|
defaultOptions: []
|
|
7621
7636
|
},
|
|
7622
7637
|
create(context) {
|
|
7638
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
7623
7639
|
const services = ESLintUtils.getParserServices(context);
|
|
7624
7640
|
const checker = services.program.getTypeChecker();
|
|
7625
7641
|
function checkParam(param) {
|
|
@@ -8531,6 +8547,7 @@ const requireCompilerOptions = createRule$5({
|
|
|
8531
8547
|
create(context, [options]) {
|
|
8532
8548
|
const requirements = readCompilerOptionRequirements(options);
|
|
8533
8549
|
if (requirements.length === 0) return {};
|
|
8550
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
8534
8551
|
const { program } = ESLintUtils.getParserServices(context);
|
|
8535
8552
|
const signature = JSON.stringify(requirements.map((requirement) => [requirement.name, requirement.spelled]));
|
|
8536
8553
|
return { Program(node) {
|
|
@@ -8988,6 +9005,7 @@ const scopedFirstParameter = ESLintUtils.RuleCreator((name) => `https://github.c
|
|
|
8988
9005
|
create(context, [options]) {
|
|
8989
9006
|
const { interfaces, name: requiredName, type: requiredType } = readScopedFirstParameterOptions(options);
|
|
8990
9007
|
const { sourceCode } = context;
|
|
9008
|
+
if (!isEstreeSource(context.sourceCode)) return {};
|
|
8991
9009
|
const services = ESLintUtils.getParserServices(context);
|
|
8992
9010
|
const checker = services.program.getTypeChecker();
|
|
8993
9011
|
const checkMembers = (owner, members) => {
|
|
@@ -12147,6 +12165,7 @@ function exadevConfig(options = {}) {
|
|
|
12147
12165
|
const gitignore = buildGitignoreConfig({ enabled: options.gitignore });
|
|
12148
12166
|
return toPublicConfigArray([
|
|
12149
12167
|
...gitignore,
|
|
12168
|
+
{ plugins: { exadev: plugin } },
|
|
12150
12169
|
...recommendedTypeChecked,
|
|
12151
12170
|
...jsdocAndTsdoc,
|
|
12152
12171
|
...jsonCanonicalConfig,
|