forked from eslint/eslint
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New: exposes rule metadata to the Node API (fixes eslint#6582)
- Loading branch information
1 parent
ee7fcfa
commit 4297749
Showing
5 changed files
with
110 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -455,9 +455,11 @@ function prepareConfig(config) { | |
globals: ConfigOps.merge({}, config.globals), | ||
env: ConfigOps.merge({}, config.env || {}), | ||
settings: ConfigOps.merge({}, config.settings || {}), | ||
parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {}) | ||
parserOptions: ConfigOps.merge(parserOptions, config.parserOptions || {}), | ||
meta: ConfigOps.merge({}, config.meta || {}) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ilyavolodin
|
||
}; | ||
|
||
|
||
if (preparedConfig.parserOptions.sourceType === "module") { | ||
if (!preparedConfig.parserOptions.ecmaFeatures) { | ||
preparedConfig.parserOptions.ecmaFeatures = {}; | ||
|
@@ -981,6 +983,10 @@ module.exports = (function() { | |
source: sourceCode.lines[location.line - 1] || "" | ||
}; | ||
|
||
if (meta) { | ||
problem.meta = meta; | ||
} | ||
|
||
// ensure there's range and text properties, otherwise it's not a valid fix | ||
if (fix && Array.isArray(fix.range) && (typeof fix.text === "string")) { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is waste of memory. We can pass the meta object by reference and it works just as well (passes the tests).