You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* refactor: use a service to emit warnings
* add `ConfigLoaderConstructorOptions` type
* apply suggestions from code review
* use preformatted message in `emitInactiveFlagWarning`
* add constructor
Copy file name to clipboardExpand all lines: lib/cli.js
+2-4Lines changed: 2 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -439,10 +439,8 @@ const cli = {
439
439
debug("Using flat config?",usingFlatConfig);
440
440
441
441
if(allowFlatConfig&&!usingFlatConfig){
442
-
process.emitWarning(
443
-
"You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.",
`Running ESLint with an empty config (from ${configFilePath}). Please double-check that this is what you want. If you want to run ESLint with an empty config, export [{}] to remove this warning.`,
'The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files',
* @param {{ emitWarning?: ((warning: string, type: string) => void) | undefined }} [options] A function called internally to emit warnings using API provided by the runtime.
* Emits a warning when circular fixes are detected while fixing a file.
28
+
* This method is used by the Linter and is safe to call outside Node.js.
29
+
* @param {string} filename The name of the file being fixed.
30
+
* @returns {void}
31
+
*/
32
+
emitCircularFixesWarning(filename){
33
+
this.emitWarning(
34
+
`Circular fixes detected while fixing ${filename}. It is likely that you have conflicting rules in your configuration.`,
35
+
"ESLintCircularFixesWarning",
36
+
);
37
+
}
38
+
39
+
/**
40
+
* Emits a warning when an empty config file has been loaded.
41
+
* @param {string} configFilePath The path to the config file.
42
+
* @returns {void}
43
+
*/
44
+
emitEmptyConfigWarning(configFilePath){
45
+
this.emitWarning(
46
+
`Running ESLint with an empty config (from ${configFilePath}). Please double-check that this is what you want. If you want to run ESLint with an empty config, export [{}] to remove this warning.`,
47
+
"ESLintEmptyConfigWarning",
48
+
);
49
+
}
50
+
51
+
/**
52
+
* Emits a warning when an ".eslintignore" file is found.
53
+
* @returns {void}
54
+
*/
55
+
emitESLintIgnoreWarning(){
56
+
this.emitWarning(
57
+
'The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignoring-files',
58
+
"ESLintIgnoreWarning",
59
+
);
60
+
}
61
+
62
+
/**
63
+
* Emits a warning when the ESLINT_USE_FLAT_CONFIG environment variable is set to "false".
64
+
* @returns {void}
65
+
*/
66
+
emitESLintRCWarning(){
67
+
this.emitWarning(
68
+
"You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.",
69
+
"ESLintRCWarning",
70
+
);
71
+
}
72
+
73
+
/**
74
+
* Emits a warning when an inactive flag is used.
75
+
* This method is used by the Linter and is safe to call outside Node.js.
0 commit comments