Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a4f8760

Browse filesBrowse files
authored
docs: revert accidental changes (#19542)
1 parent 5439525 commit a4f8760
Copy full SHA for a4f8760

File tree

2 files changed

+110
-3
lines changed
Filter options

2 files changed

+110
-3
lines changed

‎docs/src/extend/stats.md

Copy file name to clipboardExpand all lines: docs/src/extend/stats.md
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ The `Stats` value is the timing information of each lint run. The `stats` proper
3535
- `ParseTime` (`{ total: number }`)<br>
3636
The total time that is spent when parsing a file.
3737
- `RuleTime` (`{ total: number }`)<be>
38-
The total time that is spent on a rule. \* `FixTime` (`{ total: number }`)<be>
38+
The total time that is spent on a rule.
39+
- `FixTime` (`{ total: number }`)<be>
3940
The total time that is spent on applying fixes to the code.
4041

4142
### CLI usage

‎tests/lib/types/types.test.ts

Copy file name to clipboardExpand all lines: tests/lib/types/types.test.ts
+108-2Lines changed: 108 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
Scope,
3636
SourceCode,
3737
} from "eslint";
38+
import { defineConfig, globalIgnores } from "eslint/config";
3839
import { ESLintRules } from "eslint/rules";
3940
import { Linter as ESLinter } from "eslint/universal";
4041
import {
@@ -530,6 +531,68 @@ rule = {
530531
},
531532
meta: { deprecated: true, replacedBy: ["other-rule-name"] },
532533
};
534+
rule = {
535+
create(context) {
536+
return {};
537+
},
538+
meta: { deprecated: { message: "message", url: "https://example.com" } },
539+
};
540+
rule = {
541+
create(context) {
542+
return {};
543+
},
544+
meta: { deprecated: { availableUntil: "10.0.0" } },
545+
};
546+
rule = {
547+
create(context) {
548+
return {};
549+
},
550+
meta: { deprecated: { availableUntil: null } },
551+
};
552+
rule = {
553+
create(context) {
554+
return {};
555+
},
556+
meta: { deprecated: { deprecatedSince: "9.0.0" } },
557+
};
558+
rule = {
559+
create(context) {
560+
return {};
561+
},
562+
meta: { deprecated: { replacedBy: [] } },
563+
};
564+
rule = {
565+
create(context) {
566+
return {};
567+
},
568+
meta: {
569+
deprecated: {
570+
replacedBy: [{ message: "message", url: "https://example.com" }],
571+
},
572+
},
573+
};
574+
rule = {
575+
create(context) {
576+
return {};
577+
},
578+
meta: {
579+
deprecated: {
580+
replacedBy: [{ plugin: { name: "eslint-plugin-example" } }],
581+
},
582+
},
583+
};
584+
rule = {
585+
create(context) {
586+
return {};
587+
},
588+
meta: {
589+
deprecated: {
590+
replacedBy: [
591+
{ rule: { name: "rule-id", url: "https://example.com" } },
592+
],
593+
},
594+
},
595+
};
533596
rule = {
534597
create(context) {
535598
return {};
@@ -552,7 +615,7 @@ rule = {
552615
};
553616

554617
rule = {
555-
create(context) {
618+
create(context: Rule.RuleContext) {
556619
context.getAncestors();
557620

558621
context.getDeclaredVariables(AST);
@@ -569,9 +632,15 @@ rule = {
569632

570633
context.getCwd();
571634

635+
context.languageOptions;
636+
context.languageOptions
637+
.ecmaVersion satisfies Linter.LanguageOptions["ecmaVersion"];
638+
572639
context.sourceCode;
640+
context.sourceCode.getLocFromIndex(42);
573641

574642
context.getSourceCode();
643+
context.getSourceCode().getLocFromIndex(42);
575644

576645
context.getScope();
577646

@@ -583,8 +652,14 @@ rule = {
583652

584653
context.markVariableAsUsed("foo");
585654

655+
// @ts-expect-error wrong `node` type
656+
context.report({ message: "foo", node: {} });
657+
586658
context.report({ message: "foo", node: AST });
587-
context.report({ message: "foo", loc: { line: 0, column: 0 } });
659+
context.report({
660+
message: "foo",
661+
loc: { start: { line: 0, column: 0 }, end: { line: 1, column: 1 } },
662+
});
588663
context.report({ message: "foo", node: AST, data: { foo: "bar" } });
589664
context.report({ message: "foo", node: AST, fix: () => null });
590665
context.report({
@@ -661,6 +736,8 @@ rule = {
661736
],
662737
});
663738

739+
(violation: Rule.ReportDescriptor) => context.report(violation);
740+
664741
return {
665742
onCodePathStart(codePath, node) {
666743
const origin: Rule.CodePathOrigin = codePath.origin;
@@ -1935,3 +2012,32 @@ FlatESLint; // $ExpectType typeof ESLint
19352012
shouldUseFlatConfig(); // $ExpectType Promise<boolean>
19362013

19372014
// #endregion
2015+
2016+
// #region defineConfig
2017+
2018+
defineConfig([
2019+
{
2020+
files: ["*.js"],
2021+
rules: {
2022+
"no-console": "error",
2023+
},
2024+
},
2025+
]);
2026+
2027+
defineConfig([
2028+
globalIgnores(["*.js"]),
2029+
{
2030+
files: ["*.js"],
2031+
rules: {
2032+
"no-console": "error",
2033+
},
2034+
},
2035+
{
2036+
files: ["*.ts"],
2037+
rules: {
2038+
"@typescript-eslint/no-unused-vars": "error",
2039+
},
2040+
},
2041+
]);
2042+
2043+
// #endregion

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.