Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit4d11e56

Browse files
authored
feat: addname to eslint configs (#18289)
* feat: add `name` to @eslint/js configs* feat: add `name` to eslint-config-eslint configs* chore: add name to eslint.config.js* chore: update failing tests* chore: add name for eslint-comment* chore: fix failing tests
1 parent1cbe1f6 commit4d11e56

File tree

8 files changed

+26
-4
lines changed

8 files changed

+26
-4
lines changed

‎eslint.config.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ function createInternalFilesPatterns(pattern = null) {
7676
module.exports=[
7777
...eslintConfigESLintCJS,
7878
{
79+
name:"eslint/global-ignores",
7980
ignores:[
8081
"build/**",
8182
"coverage/**",
@@ -92,6 +93,7 @@ module.exports = [
9293
]
9394
},
9495
{
96+
name:"eslint/internal-rules",
9597
plugins:{
9698
"internal-rules":internalPlugin
9799
},
@@ -103,13 +105,15 @@ module.exports = [
103105
}
104106
},
105107
{
108+
name:"eslint/tools",
106109
files:["tools/*.js","docs/tools/*.js"],
107110
rules:{
108111
"no-console":"off",
109112
"n/no-process-exit":"off"
110113
}
111114
},
112115
{
116+
name:"eslint/rules",
113117
files:["lib/rules/*","tools/internal-rules/*"],
114118
ignores:["**/index.js"],
115119
...eslintPluginRulesRecommendedConfig,
@@ -123,13 +127,15 @@ module.exports = [
123127
}
124128
},
125129
{
130+
name:"eslint/core-rules",
126131
files:["lib/rules/*"],
127132
ignores:["**/index.js"],
128133
rules:{
129134
"eslint-plugin/require-meta-docs-url":["error",{pattern:"https://eslint.org/docs/latest/rules/{{name}}"}]
130135
}
131136
},
132137
{
138+
name:"eslint/rules-tests",
133139
files:["tests/lib/rules/*","tests/tools/internal-rules/*"],
134140
...eslintPluginTestsRecommendedConfig,
135141
rules:{
@@ -150,6 +156,7 @@ module.exports = [
150156
}
151157
},
152158
{
159+
name:"eslint/tests",
153160
files:["tests/**/*.js"],
154161
languageOptions:{
155162
globals:{
@@ -166,6 +173,7 @@ module.exports = [
166173

167174
// Restrict relative path imports
168175
{
176+
name:"eslint/lib",
169177
files:["lib/*"],
170178
ignores:["lib/unsupported-api.js"],
171179
rules:{
@@ -175,6 +183,7 @@ module.exports = [
175183
}
176184
},
177185
{
186+
name:"eslint/cli-engine",
178187
files:[INTERNAL_FILES.CLI_ENGINE_PATTERN],
179188
rules:{
180189
"n/no-restricted-require":["error",[
@@ -183,6 +192,7 @@ module.exports = [
183192
}
184193
},
185194
{
195+
name:"eslint/linter",
186196
files:[INTERNAL_FILES.LINTER_PATTERN],
187197
rules:{
188198
"n/no-restricted-require":["error",[
@@ -194,6 +204,7 @@ module.exports = [
194204
}
195205
},
196206
{
207+
name:"eslint/rules",
197208
files:[INTERNAL_FILES.RULES_PATTERN],
198209
rules:{
199210
"n/no-restricted-require":["error",[
@@ -207,6 +218,7 @@ module.exports = [
207218
}
208219
},
209220
{
221+
name:"eslint/shared",
210222
files:["lib/shared/**/*"],
211223
rules:{
212224
"n/no-restricted-require":["error",[
@@ -219,6 +231,7 @@ module.exports = [
219231
}
220232
},
221233
{
234+
name:"eslint/source-code",
222235
files:[INTERNAL_FILES.SOURCE_CODE_PATTERN],
223236
rules:{
224237
"n/no-restricted-require":["error",[
@@ -232,6 +245,7 @@ module.exports = [
232245
}
233246
},
234247
{
248+
name:"eslint/rule-tester",
235249
files:[INTERNAL_FILES.RULE_TESTER_PATTERN],
236250
rules:{
237251
"n/no-restricted-require":["error",[

‎packages/eslint-config-eslint/base.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const unicorn = require("eslint-plugin-unicorn");
77

88
// extends eslint recommended config
99
constjsConfigs=[js.configs.recommended,{
10+
name:"eslint-config-eslint/js",
1011
rules:{
1112
"array-bracket-spacing":"error",
1213
"array-callback-return":"error",
@@ -259,6 +260,7 @@ const jsConfigs = [js.configs.recommended, {
259260

260261
// extends eslint-plugin-jsdoc's recommended config
261262
constjsdocConfigs=[jsdoc.configs["flat/recommended"],{
263+
name:"eslint-config-eslint/jsdoc",
262264
settings:{
263265
jsdoc:{
264266
mode:"typescript",
@@ -350,6 +352,7 @@ const jsdocConfigs = [jsdoc.configs["flat/recommended"], {
350352

351353
// extends eslint-plugin-unicorn's config
352354
constunicornConfigs=[{
355+
name:"eslint-config-eslint/unicorn",
353356
plugins:{ unicorn},
354357
rules:{
355358
"unicorn/prefer-array-find":"error",
@@ -368,6 +371,7 @@ const unicornConfigs = [{
368371

369372
// extends@eslint-community/eslint-plugin-eslint-comments's recommended config
370373
consteslintCommentsConfigs=[eslintCommentsPluginConfigs.recommended,{
374+
name:"eslint-config-eslint/eslint-comments",
371375
rules:{
372376
"@eslint-community/eslint-comments/disable-enable-pair":["error"],
373377
"@eslint-community/eslint-comments/no-unused-disable":"error",
@@ -376,7 +380,7 @@ const eslintCommentsConfigs = [eslintCommentsPluginConfigs.recommended, {
376380
}];
377381

378382
module.exports=[
379-
{linterOptions:{reportUnusedDisableDirectives:"error"}},
383+
{name:"eslint-config-eslint/base",linterOptions:{reportUnusedDisableDirectives:"error"}},
380384
...jsConfigs,
381385
...unicornConfigs,
382386
...jsdocConfigs,

‎packages/eslint-config-eslint/nodejs.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const sharedRules = {
1111
constcjsConfigs=[
1212
recommendedScriptConfig,
1313
{
14+
name:"eslint-config-eslint/cjs",
1415
rules:{
1516
...sharedRules,
1617
"n/no-mixed-requires":"error",
@@ -23,6 +24,7 @@ const cjsConfigs = [
2324
constesmConfigs=[
2425
recommendedModuleConfig,
2526
{
27+
name:"eslint-config-eslint/esm",
2628
rules:sharedRules
2729
}
2830
];

‎packages/js/src/configs/eslint-all.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/* eslint quote-props: off -- autogenerated so don't lint */
88

99
module.exports=Object.freeze({
10+
"name":"@eslint/js/all",
1011
"rules":{
1112
"accessor-pairs":"error",
1213
"array-callback-return":"error",

‎packages/js/src/configs/eslint-recommended.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */
1010

1111
module.exports=Object.freeze({
12+
name:"@eslint/js/recommended",
1213
rules:Object.freeze({
1314
"constructor-super":"error",
1415
"for-direction":"error",

‎tests/fixtures/config-file/js/.eslintrc.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module.exports={
2+
extends:"eslint:recommended",
23
rules:{
34
semi:[2,"always"]
45
}

‎tests/lib/cli.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,7 +1771,7 @@ describe("cli", () => {
17711771
getFixturePath("globals-node.js")
17721772
];
17731773

1774-
awaitcli.execute(`--no-eslintrc --config ./packages/js/src/configs/eslint-recommended.js --no-ignore${files.join(" ")}`,null,false);
1774+
awaitcli.execute(`--no-eslintrc --config ./tests/fixtures/config-file/js/.eslintrc.js --no-ignore${files.join(" ")}`,null,false);
17751775

17761776
assert.strictEqual(log.info.args[0][0].split("\n").length,10);
17771777
});
@@ -1903,7 +1903,6 @@ describe("cli", () => {
19031903
});
19041904
});
19051905
});
1906-
19071906
});
19081907

19091908
});

‎tools/update-eslint-all.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const code = `/*
3636
3737
/* eslint quote-props: off -- autogenerated so don't lint */
3838
39-
module.exports = Object.freeze(${JSON.stringify({rules:allRules},null,4)});
39+
module.exports = Object.freeze(${JSON.stringify({name:"@eslint/js/all",rules:allRules},null,4)});
4040
`;
4141

4242
fs.writeFileSync("./packages/js/src/configs/eslint-all.js",code,"utf8");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp