Skip to content

Commit

Permalink
refactor: Return value of applyInlineConfig() (eslint#18623)
Browse files Browse the repository at this point in the history
  • Loading branch information
nzakas authored Jun 24, 2024
1 parent 375227f commit 69ff64e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/languages/js/source-code/source-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ class SourceCode extends TokenStore {
/**
* Applies configuration found inside of the source code. This method is only
* called when ESLint is running with inline configuration allowed.
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,node:ASTNode}}} Information
* @returns {{problems:Array<Problem>,configs:{config:FlatConfigArray,loc:Location}}} Information
* that ESLint needs to further process the inline configuration.
*/
applyInlineConfig() {
Expand Down Expand Up @@ -1154,7 +1154,7 @@ class SourceCode extends TokenStore {
config: {
rules: parseResult.config
},
node: comment
loc: comment.loc
});
} else {
problems.push({
Expand Down
8 changes: 4 additions & 4 deletions lib/linter/linter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ class Linter {
// next we need to verify information about the specified rules
const ruleValidator = new RuleValidator();

for (const { config: inlineConfig, node } of inlineConfigResult.configs) {
for (const { config: inlineConfig, loc } of inlineConfigResult.configs) {

Object.keys(inlineConfig.rules).forEach(ruleId => {
const rule = getRuleFromConfig(ruleId, config);
Expand All @@ -1773,7 +1773,7 @@ class Linter {
if (!rule) {
inlineConfigProblems.push(createLintingProblem({
ruleId,
loc: node.loc,
loc,
language: config.language
}));
return;
Expand All @@ -1782,7 +1782,7 @@ class Linter {
if (Object.hasOwn(mergedInlineConfig.rules, ruleId)) {
inlineConfigProblems.push(createLintingProblem({
message: `Rule "${ruleId}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`,
loc: node.loc,
loc,
language: config.language
}));
return;
Expand Down Expand Up @@ -1875,7 +1875,7 @@ class Linter {
inlineConfigProblems.push(createLintingProblem({
ruleId,
message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`,
loc: node.loc,
loc,
language: config.language
}));
}
Expand Down

0 comments on commit 69ff64e

Please sign in to comment.