Skip to content

Commit 306ea7f

Browse files
authored
Merge branch 'main' into docs-correct-formatting-in-no-irregular-whitespace-rule-documentation
2 parents 63b8551 + 4168a18 commit 306ea7f

File tree

8 files changed

+118
-21
lines changed

8 files changed

+118
-21
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ fnx
287287
Josh Goldberg ✨
288288
</a>
289289
</td><td align="center" valign="top" width="11%">
290+
<a href="https://github.com/SwetaTanwar">
291+
<img src="https://github.com/SwetaTanwar.png?s=75" width="75" height="75" alt="Sweta Tanwar's Avatar"><br />
292+
Sweta Tanwar
293+
</a>
294+
</td><td align="center" valign="top" width="11%">
290295
<a href="https://github.com/Tanujkanti4441">
291296
<img src="https://github.com/Tanujkanti4441.png?s=75" width="75" height="75" alt="Tanuj Kanti's Avatar"><br />
292297
Tanuj Kanti
@@ -296,6 +301,11 @@ Tanuj Kanti
296301
<img src="https://github.com/lumirlumir.png?s=75" width="75" height="75" alt="루밀LuMir's Avatar"><br />
297302
루밀LuMir
298303
</a>
304+
</td><td align="center" valign="top" width="11%">
305+
<a href="https://github.com/Pixel998">
306+
<img src="https://github.com/Pixel998.png?s=75" width="75" height="75" alt="Pixel998's Avatar"><br />
307+
Pixel998
308+
</a>
299309
</td></tr></tbody></table>
300310

301311
### Website Team

docs/src/library/rule-list.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The rule list is a macro defined in `components/rule-list.macro.html`. The macro
1414

1515
<!-- use the macro -->
1616
{{ replacementRuleList({ specifiers: [{ rule: { name: 'global-require', url:
17-
'...' }, plugin: { name: '@eslint-comunnity/eslint-plugin-n', url: '...' } }] })
17+
'...' }, plugin: { name: '@eslint-community/eslint-plugin-n', url: '...' } }] })
1818
}}
1919
```
2020

@@ -24,4 +24,4 @@ The rule list is a macro defined in `components/rule-list.macro.html`. The macro
2424

2525
{% from 'components/rule-list.macro.html' import replacementRuleList %}
2626

27-
{{ replacementRuleList({ specifiers: [{ rule: { name: 'global-require', url: '...' }, plugin: { name: '@eslint-comunnity/eslint-plugin-n', url: '...' } }] }) }}
27+
{{ replacementRuleList({ specifiers: [{ rule: { name: 'global-require', url: '...' }, plugin: { name: '@eslint-community/eslint-plugin-n', url: '...' } }] }) }}

lib/eslint/eslint-helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ async function globMultiSearch({
506506
* @param {boolean} args.globInputPaths true to interpret glob patterns,
507507
* false to not interpret glob patterns.
508508
* @param {string} args.cwd The current working directory to find from.
509-
* @param {ConfigLoader|LegacyConfigLoader} args.configLoader The config loeader for the current run.
509+
* @param {ConfigLoader|LegacyConfigLoader} args.configLoader The config loader for the current run.
510510
* @param {boolean} args.errorOnUnmatchedPattern Determines if an unmatched pattern
511511
* should throw an error.
512512
* @returns {Promise<Array<string>>} The fully resolved file paths.

lib/shared/serialization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function isSerializable(val, seenObjects = new Set()) {
5656
/*
5757
* We're creating a new Set of seen objects because we want to
5858
* ensure that `val` doesn't appear again in this path, but it can appear
59-
* in other paths. This allows for resuing objects in the graph, as long as
59+
* in other paths. This allows for reusing objects in the graph, as long as
6060
* there are no cycles.
6161
*/
6262
!isSerializable(

lib/types/index.d.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,11 +222,16 @@ export class SourceCode
222222

223223
getDeclaredVariables(node: ESTree.Node): Scope.Variable[];
224224

225+
/** @deprecated */
225226
getJSDocComment(node: ESTree.Node): ESTree.Comment | null;
226227

227228
getNodeByRangeIndex(index: number): ESTree.Node | null;
228229

229-
isSpaceBetweenTokens(first: AST.Token, second: AST.Token): boolean;
230+
/** @deprecated Use `isSpaceBetween()` instead. */
231+
isSpaceBetweenTokens(
232+
first: ESTree.Node | AST.Token,
233+
second: ESTree.Node | AST.Token,
234+
): boolean;
230235

231236
getLocFromIndex(index: number): ESTree.Position;
232237

@@ -260,6 +265,18 @@ export class SourceCode
260265

261266
getTokensAfter: SourceCode.UnaryCursorWithCountOptions;
262267

268+
/** @deprecated Use `getTokenBefore()` instead. */
269+
getTokenOrCommentBefore(
270+
node: ESTree.Node | AST.Token | ESTree.Comment,
271+
skip?: number | undefined,
272+
): AST.Token | ESTree.Comment | null;
273+
274+
/** @deprecated Use `getTokenAfter()` instead. */
275+
getTokenOrCommentAfter(
276+
node: ESTree.Node | AST.Token | ESTree.Comment,
277+
skip?: number | undefined,
278+
): AST.Token | ESTree.Comment | null;
279+
263280
getFirstTokenBetween: SourceCode.BinaryCursorWithSkipOptions;
264281

265282
getFirstTokensBetween: SourceCode.BinaryCursorWithCountOptions;
@@ -306,9 +323,10 @@ export namespace SourceCode {
306323
interface Config {
307324
text: string;
308325
ast: AST.Program;
309-
parserServices?: ParserServices | undefined;
310-
scopeManager?: Scope.ScopeManager | undefined;
311-
visitorKeys?: VisitorKeys | undefined;
326+
hasBOM?: boolean | undefined;
327+
parserServices?: ParserServices | null | undefined;
328+
scopeManager?: Scope.ScopeManager | null | undefined;
329+
visitorKeys?: VisitorKeys | null | undefined;
312330
}
313331

314332
type ParserServices = any;

tests/lib/eslint/legacy-eslint.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3028,7 +3028,7 @@ describe("LegacyESLint", () => {
30283028
}, /Error while processing options validation schema of rule 'schema-invalid\/rule1': minItems must be number/u);
30293029
});
30303030

3031-
it("should succesfully execute with a rule with `schema:false` from a plugin when no options were passed", async () => {
3031+
it("should successfully execute with a rule with `schema:false` from a plugin when no options were passed", async () => {
30323032
eslint = new LegacyESLint({
30333033
cwd: path.join(fixtureDir, "plugins"),
30343034
baseConfig: {
@@ -3055,7 +3055,7 @@ describe("LegacyESLint", () => {
30553055
);
30563056
});
30573057

3058-
it("should succesfully execute with a rule with `schema:false` from a plugin when an option is passed", async () => {
3058+
it("should successfully execute with a rule with `schema:false` from a plugin when an option is passed", async () => {
30593059
eslint = new LegacyESLint({
30603060
cwd: path.join(fixtureDir, "plugins"),
30613061
baseConfig: {
@@ -3082,7 +3082,7 @@ describe("LegacyESLint", () => {
30823082
);
30833083
});
30843084

3085-
it("should succesfully execute with a rule with `schema:[]` from a plugin when no options were passed", async () => {
3085+
it("should successfully execute with a rule with `schema:[]` from a plugin when no options were passed", async () => {
30863086
eslint = new LegacyESLint({
30873087
cwd: path.join(fixtureDir, "plugins"),
30883088
baseConfig: {
@@ -3131,7 +3131,7 @@ describe("LegacyESLint", () => {
31313131
}, /Configuration for rule "schema-empty-array\/rule1" is invalid.*should NOT have more than 0 items/su);
31323132
});
31333133

3134-
it("should succesfully execute with a rule with no schema from a plugin when no options were passed", async () => {
3134+
it("should successfully execute with a rule with no schema from a plugin when no options were passed", async () => {
31353135
eslint = new LegacyESLint({
31363136
cwd: path.join(fixtureDir, "plugins"),
31373137
baseConfig: {
@@ -3178,7 +3178,7 @@ describe("LegacyESLint", () => {
31783178
}, /Configuration for rule "schema-missing\/rule1" is invalid.*should NOT have more than 0 items/su);
31793179
});
31803180

3181-
it("should succesfully execute with a rule with an array schema from a plugin when no options were passed", async () => {
3181+
it("should successfully execute with a rule with an array schema from a plugin when no options were passed", async () => {
31823182
eslint = new LegacyESLint({
31833183
cwd: path.join(fixtureDir, "plugins"),
31843184
baseConfig: {
@@ -3205,7 +3205,7 @@ describe("LegacyESLint", () => {
32053205
);
32063206
});
32073207

3208-
it("should succesfully execute with a rule with an array schema from a plugin when a correct option was passed", async () => {
3208+
it("should successfully execute with a rule with an array schema from a plugin when a correct option was passed", async () => {
32093209
eslint = new LegacyESLint({
32103210
cwd: path.join(fixtureDir, "plugins"),
32113211
baseConfig: {
@@ -3280,7 +3280,7 @@ describe("LegacyESLint", () => {
32803280
}, /Configuration for rule "schema-array\/rule1" is invalid.*should NOT have more than 1 items/su);
32813281
});
32823282

3283-
it("should succesfully execute with a rule with an object schema from a plugin when no options were passed", async () => {
3283+
it("should successfully execute with a rule with an object schema from a plugin when no options were passed", async () => {
32843284
eslint = new LegacyESLint({
32853285
cwd: path.join(fixtureDir, "plugins"),
32863286
baseConfig: {
@@ -3307,7 +3307,7 @@ describe("LegacyESLint", () => {
33073307
);
33083308
});
33093309

3310-
it("should succesfully execute with a rule with an object schema from a plugin when a correct option was passed", async () => {
3310+
it("should successfully execute with a rule with an object schema from a plugin when a correct option was passed", async () => {
33113311
eslint = new LegacyESLint({
33123312
cwd: path.join(fixtureDir, "plugins"),
33133313
baseConfig: {
@@ -4290,7 +4290,7 @@ describe("LegacyESLint", () => {
42904290
* Run 1: Lint result wasn't already cached.
42914291
* Run 2: Lint result was already cached. The cached lint result is used but the cache is reconciled before the run ends.
42924292
* Run 3: Lint result was already cached. The cached lint result was being used throughout the previous run, so possible
4293-
* mutations in the previous run that occured after the cache was reconciled may have side effects for this run.
4293+
* mutations in the previous run that occurred after the cache was reconciled may have side effects for this run.
42944294
*/
42954295
for (let i = 0; i < 3; i++) {
42964296
const [result] = await eslint.lintFiles([filePath]);
@@ -4359,7 +4359,7 @@ describe("LegacyESLint", () => {
43594359
* Run 1: Lint result wasn't already cached.
43604360
* Run 2: Lint result was already cached. The cached lint result is used but the cache is reconciled before the run ends.
43614361
* Run 3: Lint result was already cached. The cached lint result was being used throughout the previous run, so possible
4362-
* mutations in the previous run that occured after the cache was reconciled may have side effects for this run.
4362+
* mutations in the previous run that occurred after the cache was reconciled may have side effects for this run.
43634363
*/
43644364
for (let i = 0; i < 3; i++) {
43654365
const [result] = await eslint.lintFiles([filePath]);

tests/lib/types/types.test.ts

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,52 @@ const COMMENT: Comment = {
9393

9494
// #region SourceCode
9595

96-
let sourceCode = new SourceCode(SOURCE, AST);
96+
let sourceCode: SourceCode;
97+
98+
sourceCode = new SourceCode(SOURCE, AST);
99+
sourceCode = new SourceCode({ text: SOURCE, ast: AST });
100+
sourceCode = new SourceCode({ text: SOURCE, ast: AST, hasBOM: true });
101+
sourceCode = new SourceCode({ text: SOURCE, ast: AST, hasBOM: undefined });
102+
sourceCode = new SourceCode({
103+
text: SOURCE,
104+
ast: AST,
105+
parserServices: {
106+
foo() {},
107+
},
108+
});
109+
sourceCode = new SourceCode({ text: SOURCE, ast: AST, parserServices: null });
110+
sourceCode = new SourceCode({
111+
text: SOURCE,
112+
ast: AST,
113+
parserServices: undefined,
114+
});
115+
sourceCode = new SourceCode({
116+
text: SOURCE,
117+
ast: AST,
118+
scopeManager: {
119+
scopes: [],
120+
globalScope: null,
121+
acquire(node, inner) {
122+
return scopeManager.scopes[0];
123+
},
124+
getDeclaredVariables() {
125+
return [];
126+
},
127+
},
128+
});
129+
sourceCode = new SourceCode({ text: SOURCE, ast: AST, scopeManager: null });
130+
sourceCode = new SourceCode({
131+
text: SOURCE,
132+
ast: AST,
133+
scopeManager: undefined,
134+
});
135+
sourceCode = new SourceCode({
136+
text: SOURCE,
137+
ast: AST,
138+
visitorKeys: { ArrayExpression: ["elements"] },
139+
});
140+
sourceCode = new SourceCode({ text: SOURCE, ast: AST, visitorKeys: null });
141+
sourceCode = new SourceCode({ text: SOURCE, ast: AST, visitorKeys: undefined });
97142

98143
SourceCode.splitLines(SOURCE);
99144

@@ -113,6 +158,8 @@ sourceCode.getNodeByRangeIndex(0);
113158
sourceCode.getNodeByRangeIndex(0);
114159

115160
sourceCode.isSpaceBetweenTokens(TOKEN, TOKEN);
161+
sourceCode.isSpaceBetweenTokens(AST, TOKEN);
162+
sourceCode.isSpaceBetweenTokens(TOKEN, AST);
116163

117164
sourceCode.isSpaceBetween(TOKEN, TOKEN);
118165
sourceCode.isSpaceBetween(AST, TOKEN);
@@ -292,6 +339,16 @@ sourceCode.getTokensAfter(AST, {
292339
sourceCode.getTokensAfter(TOKEN, 0);
293340
sourceCode.getTokensAfter(COMMENT, 0);
294341

342+
sourceCode.getTokenOrCommentBefore(AST);
343+
sourceCode.getTokenOrCommentBefore(AST, 0);
344+
sourceCode.getTokenOrCommentBefore(TOKEN, 0);
345+
sourceCode.getTokenOrCommentBefore(COMMENT, 0);
346+
347+
sourceCode.getTokenOrCommentAfter(AST);
348+
sourceCode.getTokenOrCommentAfter(AST, 0);
349+
sourceCode.getTokenOrCommentAfter(TOKEN, 0);
350+
sourceCode.getTokenOrCommentAfter(COMMENT, 0);
351+
295352
sourceCode.getFirstTokenBetween(AST, AST); // $ExpectType Token | null
296353
sourceCode.getFirstTokenBetween(AST, AST, 0);
297354
sourceCode.getFirstTokenBetween(AST, AST, { skip: 0 });
@@ -2046,6 +2103,18 @@ ruleTester.run("simple-valid-test", rule2, {
20462103
},
20472104
});
20482105

2106+
interface CustomParserServices {
2107+
program: any;
2108+
}
2109+
2110+
(parserServices: CustomParserServices): Linter.Config => ({
2111+
languageOptions: {
2112+
parser: {
2113+
parseForESLint: () => ({ ast: AST, services: parserServices }),
2114+
},
2115+
},
2116+
});
2117+
20492118
(): Linter.Config => ({
20502119
languageOptions: {
20512120
// @ts-expect-error

tools/update-readme.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ function formatTeamMembers(members) {
6363
<a href="https://github.com/${member.username}">
6464
<img src="https://github.com/${
6565
member.username
66-
}.png?s=75" width="75" height="75" alt="${member.name.trim()}'s Avatar"><br />
67-
${member.name.trim()}
66+
}.png?s=75" width="75" height="75" alt="${member.name?.trim() ?? member.username}'s Avatar"><br />
67+
${member.name?.trim() ?? member.username}
6868
</a>
6969
</td>${(index + 1) % 9 === 0 ? "</tr><tr>" : ""}`,
7070
)

0 commit comments

Comments
 (0)