eslint-find-rules
Advanced tools
Comparing version 3.3.1 to 3.4.0
@@ -8,2 +8,3 @@ 'use strict'; | ||
var eslint = require('eslint'); | ||
var glob = require('glob'); | ||
var isAbsolute = require('path-is-absolute'); | ||
@@ -24,3 +25,3 @@ var difference = require('./array-diff'); | ||
function _getConfig(configFile) { | ||
function _getConfigs(configFile, files) { | ||
var cliEngine = new eslint.CLIEngine({ | ||
@@ -32,5 +33,13 @@ // Ignore any config applicable depending on the location on the filesystem | ||
}); | ||
return cliEngine.getConfigForFile(); | ||
return new Set(files.map(function (filePath) { | ||
return cliEngine.isPathIgnored(filePath) ? false : cliEngine.getConfigForFile(filePath); | ||
}).filter(Boolean)); | ||
} | ||
function _getConfig(configFile, files) { | ||
return Array.from(_getConfigs(configFile, files)).reduce(function (prev, item) { | ||
return Object.assign(prev, item, { rules: Object.assign({}, prev.rules, item.rules) }); | ||
}, {}); | ||
} | ||
function _getCurrentNamesRules(config) { | ||
@@ -41,12 +50,23 @@ return Object.keys(config.rules); | ||
function _normalizePluginName(name) { | ||
var scopedRegex = /(@[^/]+)\/(.+)/; | ||
var scopedRegex = /(@[^/]+)(\/(.+))?/; | ||
var match = scopedRegex.exec(name); | ||
/* istanbul ignore if: cannot test this branch in eslint <5 */ | ||
if (match) { | ||
if (match[3]) { | ||
// @scoped/name => @scope/eslint-plugin-name | ||
return { | ||
module: match[1] + '/eslint-plugin-' + match[3], | ||
prefix: match[1] + '/' + match[3] | ||
}; | ||
} | ||
// @scoped => @scope/eslint-plugin | ||
return { | ||
module: match[1] + '/eslint-plugin-' + match[2], | ||
prefix: match[2] | ||
module: match[1] + '/eslint-plugin', | ||
prefix: match[1] | ||
}; | ||
} | ||
// Name => eslint-plugin-name | ||
return { | ||
@@ -69,2 +89,3 @@ module: 'eslint-plugin-' + name, | ||
var plugins = config.plugins; | ||
/* istanbul ignore else */ | ||
if (plugins) { | ||
@@ -103,3 +124,4 @@ plugins.forEach(function (plugin) { | ||
var configFile = _getConfigFile(specifiedFile); | ||
var config = _getConfig(configFile); | ||
var files = glob.sync('**/*.js', { dot: true, matchBase: true }); | ||
var config = _getConfig(configFile, files); | ||
var currentRuleNames = _getCurrentNamesRules(config); | ||
@@ -106,0 +128,0 @@ if (omitCore) { |
{ | ||
"name": "eslint-find-rules", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "Find built-in ESLint rules you don't have in your custom config.", | ||
"main": "dist/lib/rule-finder.js", | ||
"scripts": { | ||
"cover": "nyc --reporter=lcov --reporter=text npm test", | ||
"lint": "xo", | ||
"cover": "nyc --reporter=lcov --reporter=text --reporter=html npm test", | ||
"lint": "eslint --ext .js,.json .", | ||
"test": "mocha --recursive", | ||
@@ -35,2 +35,3 @@ "update-contributors": "all-contributors generate", | ||
"eslint-rule-documentation": "^1.0.0", | ||
"glob": "^7.1.4", | ||
"path-is-absolute": "^1.0.1", | ||
@@ -50,3 +51,4 @@ "which": "^1.2.8", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"eslint": "^3.12.0 || ^4 || ^5", | ||
"eslint": "^3.12.0 || ^4 || ^5 || ^6", | ||
"eslint-plugin-json": "^1.4.0", | ||
"ghooks": "^2.0.0", | ||
@@ -61,7 +63,6 @@ "mocha": "^3.0.1", | ||
"travis-after-all": "^1.4.4", | ||
"validate-commit-msg": "^2.12.2", | ||
"xo": "^0.18.2" | ||
"validate-commit-msg": "^2.12.2" | ||
}, | ||
"peerDependencies": { | ||
"eslint": "^3.12.0 || ^4 || ^5" | ||
"eslint": "^3.12.0 || ^4 || ^5 || ^6" | ||
}, | ||
@@ -89,10 +90,3 @@ "nyc": { | ||
}, | ||
"homepage": "https://github.com/sarbbottam/eslint-find-rules#readme", | ||
"xo": { | ||
"envs": [ | ||
"mocha" | ||
], | ||
"esnext": true, | ||
"space": true | ||
} | ||
"homepage": "https://github.com/sarbbottam/eslint-find-rules#readme" | ||
} |
@@ -14,3 +14,3 @@ # eslint-find-rules | ||
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors) | ||
@@ -138,3 +138,3 @@ ## Acknowledgment | ||
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | | ||
| [<img src="https://avatars1.githubusercontent.com/u/1406203?v=3" width="100px;"/><br /><sub><b>Randy Coulman</b></sub>](https://github.com/randycoulman)<br />[💻](https://github.com/sarbbottam/eslint-find-rules/commits?author=randycoulman "Code") [⚠️](https://github.com/sarbbottam/eslint-find-rules/commits?author=randycoulman "Tests") | [<img src="https://avatars1.githubusercontent.com/u/45469?v=4" width="100px;"/><br /><sub><b>Jordan Harband</b></sub>](https://twitter.com/ljharb)<br />[📖](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Documentation") [🐛](https://github.com/sarbbottam/eslint-find-rules/issues?q=author%3Aljharb "Bug reports") [💻](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Code") [💬](#question-ljharb "Answering Questions") [👀](#review-ljharb "Reviewed Pull Requests") [⚠️](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Tests") [🚇](#infra-ljharb "Infrastructure (Hosting, Build-Tools, etc)") | | ||
| [<img src="https://avatars1.githubusercontent.com/u/1406203?v=3" width="100px;"/><br /><sub><b>Randy Coulman</b></sub>](https://github.com/randycoulman)<br />[💻](https://github.com/sarbbottam/eslint-find-rules/commits?author=randycoulman "Code") [⚠️](https://github.com/sarbbottam/eslint-find-rules/commits?author=randycoulman "Tests") | [<img src="https://avatars1.githubusercontent.com/u/45469?v=4" width="100px;"/><br /><sub><b>Jordan Harband</b></sub>](https://twitter.com/ljharb)<br />[📖](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Documentation") [🐛](https://github.com/sarbbottam/eslint-find-rules/issues?q=author%3Aljharb "Bug reports") [💻](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Code") [💬](#question-ljharb "Answering Questions") [👀](#review-ljharb "Reviewed Pull Requests") [⚠️](https://github.com/sarbbottam/eslint-find-rules/commits?author=ljharb "Tests") [🚇](#infra-ljharb "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars1.githubusercontent.com/u/7462525?v=4" width="100px;"/><br /><sub><b>Brad Zacher</b></sub>](https://zacher.com.au)<br />[💻](https://github.com/sarbbottam/eslint-find-rules/commits?author=bradzacher "Code") [⚠️](https://github.com/sarbbottam/eslint-find-rules/commits?author=bradzacher "Tests") | | ||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
@@ -141,0 +141,0 @@ |
const path = require('path'); | ||
const eslint = require('eslint'); | ||
const glob = require('glob'); | ||
const isAbsolute = require('path-is-absolute'); | ||
@@ -19,3 +20,3 @@ const difference = require('./array-diff'); | ||
function _getConfig(configFile) { | ||
function _getConfigs(configFile, files) { | ||
const cliEngine = new eslint.CLIEngine({ | ||
@@ -27,5 +28,13 @@ // Ignore any config applicable depending on the location on the filesystem | ||
}); | ||
return cliEngine.getConfigForFile(); | ||
return new Set(files | ||
.map(filePath => cliEngine.isPathIgnored(filePath) ? false : cliEngine.getConfigForFile(filePath)) | ||
.filter(Boolean)); | ||
} | ||
function _getConfig(configFile, files) { | ||
return Array.from(_getConfigs(configFile, files)).reduce((prev, item) => { | ||
return Object.assign(prev, item, {rules: Object.assign({}, prev.rules, item.rules)}); | ||
}, {}); | ||
} | ||
function _getCurrentNamesRules(config) { | ||
@@ -36,12 +45,23 @@ return Object.keys(config.rules); | ||
function _normalizePluginName(name) { | ||
const scopedRegex = /(@[^/]+)\/(.+)/; | ||
const scopedRegex = /(@[^/]+)(\/(.+))?/; | ||
const match = scopedRegex.exec(name); | ||
/* istanbul ignore if: cannot test this branch in eslint <5 */ | ||
if (match) { | ||
if (match[3]) { | ||
// @scoped/name => @scope/eslint-plugin-name | ||
return { | ||
module: `${match[1]}/eslint-plugin-${match[3]}`, | ||
prefix: `${match[1]}/${match[3]}` | ||
}; | ||
} | ||
// @scoped => @scope/eslint-plugin | ||
return { | ||
module: `${match[1]}/eslint-plugin-${match[2]}`, | ||
prefix: match[2] | ||
module: `${match[1]}/eslint-plugin`, | ||
prefix: match[1] | ||
}; | ||
} | ||
// Name => eslint-plugin-name | ||
return { | ||
@@ -64,2 +84,3 @@ module: `eslint-plugin-${name}`, | ||
const plugins = config.plugins; | ||
/* istanbul ignore else */ | ||
if (plugins) { | ||
@@ -94,3 +115,4 @@ plugins.forEach(plugin => { | ||
const configFile = _getConfigFile(specifiedFile); | ||
const config = _getConfig(configFile); | ||
const files = glob.sync('**/*.js', {dot: true, matchBase: true}); | ||
const config = _getConfig(configFile, files); | ||
let currentRuleNames = _getCurrentNamesRules(config); | ||
@@ -97,0 +119,0 @@ if (omitCore) { |
@@ -5,4 +5,22 @@ const path = require('path'); | ||
let ModuleResolver; | ||
try { | ||
// eslint 6 and over: load the actual module | ||
// eslint-disable-next-line import/no-unresolved | ||
ModuleResolver = require('eslint/lib/shared/relative-module-resolver'); | ||
} catch (err) { | ||
if (err.code !== 'MODULE_NOT_FOUND') { | ||
throw err; | ||
} | ||
// eslint < 6: ModuleResolver is `undefined`, which is okay. The proxyquire | ||
// override for ../shared/relative-module-resolver won't be used because | ||
// eslint < 6 does not have that module and so does not try to load it. | ||
ModuleResolver = undefined; | ||
} | ||
const processCwd = process.cwd; | ||
const eslintVersion = process.env.ESLINT === '3' || process.env.ESLINT === '4' ? '<v5' : 'v5+'; | ||
const supportsScopedPlugins = process.env.ESLINT !== '3' && process.env.ESLINT !== '4'; | ||
const getRuleFinder = proxyquire('../../src/lib/rule-finder', { | ||
@@ -20,2 +38,27 @@ eslint: { | ||
}, | ||
// | ||
// This following module override is needed for eslint v6 and over. The module | ||
// path that we pass here is literally the one used in eslint (specifially in | ||
// eslint/lib/cli-engine/config-array-factory.js) | ||
// | ||
// The stock `resolve` method attempts to resolve to a file path the module | ||
// name passed in `name` relative to the path in `relative`. We have to | ||
// override that function, otherwise eslint fails to "load" our plugins. | ||
// | ||
'../shared/relative-module-resolver': { | ||
resolve(name, relative) { | ||
// The strategy is simple: if called with one of our plugins, just return | ||
// the module name, as-is. This is a lie because what we return is not a | ||
// path, but it is simple, and works. Otherwise, we just call the original | ||
// `resolve` from the stock module. | ||
return ['eslint-plugin-plugin', | ||
'eslint-plugin-no-rules', | ||
'@scope/eslint-plugin-scoped-plugin', | ||
'@scope/eslint-plugin'].includes(name) ? | ||
name : | ||
ModuleResolver.resolve(name, relative); | ||
}, | ||
'@global': true, | ||
'@noCallThru': true | ||
}, | ||
'eslint-plugin-plugin': { | ||
@@ -44,5 +87,31 @@ rules: { | ||
'@global': true | ||
}, | ||
'@scope/eslint-plugin': { | ||
rules: { | ||
'foo-rule': {}, | ||
'old-plugin-rule': {meta: {deprecated: true}}, | ||
'bar-rule': {} | ||
}, | ||
'@noCallThru': true, | ||
'@global': true | ||
} | ||
}); | ||
function assertDeepEqual(a, b) { | ||
if (supportsScopedPlugins) { | ||
return assert.deepEqual(a, b); | ||
} | ||
if (Array.isArray(b)) { | ||
return assert.deepEqual(a, b.filter(s => !s.startsWith('@'))); | ||
} | ||
const bWithoutScoped = Object.keys(b).filter(s => !s.startsWith('@')).reduce((acc, k) => { | ||
acc[k] = b[k]; | ||
return acc; | ||
}, {}); | ||
return assert.deepEqual(a, bWithoutScoped); | ||
} | ||
const getRuleFinderForDedupeTests = proxyquire('../../src/lib/rule-finder', { | ||
@@ -60,2 +129,13 @@ eslint: { | ||
}, | ||
// See the long comment in `getRuleFinder` above to learn what the point of | ||
// this override is. | ||
'../shared/relative-module-resolver': { | ||
resolve(name, relative) { | ||
return name === 'eslint-plugin-plugin' ? | ||
name : | ||
ModuleResolver.resolve(name, relative); | ||
}, | ||
'@global': true, | ||
'@noCallThru': true | ||
}, | ||
'eslint-plugin-plugin': { | ||
@@ -71,8 +151,8 @@ rules: { | ||
const noSpecifiedFile = path.resolve(process.cwd(), './test/fixtures/no-path'); | ||
const specifiedFileRelative = './test/fixtures/eslint.json'; | ||
const noSpecifiedFile = path.resolve(process.cwd(), `./test/fixtures/${eslintVersion}/no-path`); | ||
const specifiedFileRelative = `./test/fixtures/${eslintVersion}/eslint.json`; | ||
const specifiedFileAbsolute = path.join(process.cwd(), specifiedFileRelative); | ||
const noRulesFile = path.join(process.cwd(), './test/fixtures/eslint-with-plugin-with-no-rules.json'); | ||
const noDuplicateRulesFiles = './test/fixtures/eslint-dedupe-plugin-rules.json'; | ||
const usingDeprecatedRulesFile = path.join(process.cwd(), './test/fixtures/eslint-with-deprecated-rules.json'); | ||
const noRulesFile = path.join(process.cwd(), `./test/fixtures/${eslintVersion}/eslint-with-plugin-with-no-rules.json`); | ||
const noDuplicateRulesFiles = `./test/fixtures/${eslintVersion}/eslint-dedupe-plugin-rules.json`; | ||
const usingDeprecatedRulesFile = path.join(process.cwd(), `./test/fixtures/${eslintVersion}/eslint-with-deprecated-rules.json`); | ||
@@ -89,3 +169,3 @@ describe('rule-finder', () => { | ||
const ruleFinder = getRuleFinder(); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), ['bar-rule', 'baz-rule']); | ||
assertDeepEqual(ruleFinder.getUnusedRules(), ['bar-rule', 'baz-rule']); | ||
}); | ||
@@ -98,3 +178,3 @@ | ||
const ruleFinder = getRuleFinder(null, {includeDeprecated: true}); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), ['bar-rule', 'baz-rule', 'old-rule']); | ||
assertDeepEqual(ruleFinder.getUnusedRules(), ['bar-rule', 'baz-rule', 'old-rule']); | ||
}); | ||
@@ -107,3 +187,3 @@ | ||
const ruleFinder = getRuleFinder(); | ||
assert.deepEqual(ruleFinder.getCurrentRules(), ['foo-rule']); | ||
assertDeepEqual(ruleFinder.getCurrentRules(), ['foo-rule']); | ||
}); | ||
@@ -116,3 +196,3 @@ | ||
const ruleFinder = getRuleFinder(); | ||
assert.deepEqual(ruleFinder.getCurrentRulesDetailed(), {'foo-rule': [2]}); | ||
assertDeepEqual(ruleFinder.getCurrentRulesDetailed(), {'foo-rule': [2]}); | ||
}); | ||
@@ -125,3 +205,3 @@ | ||
const ruleFinder = getRuleFinder(); | ||
assert.deepEqual(ruleFinder.getPluginRules(), []); | ||
assertDeepEqual(ruleFinder.getPluginRules(), []); | ||
}); | ||
@@ -134,3 +214,3 @@ | ||
const ruleFinder = getRuleFinder(); | ||
assert.deepEqual(ruleFinder.getAllAvailableRules(), ['bar-rule', 'baz-rule', 'foo-rule']); | ||
assertDeepEqual(ruleFinder.getAllAvailableRules(), ['bar-rule', 'baz-rule', 'foo-rule']); | ||
}); | ||
@@ -143,3 +223,3 @@ | ||
const ruleFinder = getRuleFinder(null, {omitCore: true}); | ||
assert.deepEqual(ruleFinder.getAllAvailableRules(), []); | ||
assertDeepEqual(ruleFinder.getAllAvailableRules(), []); | ||
}); | ||
@@ -152,3 +232,3 @@ | ||
const ruleFinder = getRuleFinder(null, {includeDeprecated: true}); | ||
assert.deepEqual(ruleFinder.getAllAvailableRules(), ['bar-rule', 'baz-rule', 'foo-rule', 'old-rule']); | ||
assertDeepEqual(ruleFinder.getAllAvailableRules(), ['bar-rule', 'baz-rule', 'foo-rule', 'old-rule']); | ||
}); | ||
@@ -158,8 +238,9 @@ | ||
const ruleFinder = getRuleFinder(specifiedFileRelative); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), [ | ||
assertDeepEqual(ruleFinder.getUnusedRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'baz-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule' | ||
'plugin/foo-rule' | ||
]); | ||
@@ -170,3 +251,7 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative, {includeDeprecated: true}); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), [ | ||
assertDeepEqual(ruleFinder.getUnusedRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'baz-rule', | ||
@@ -177,5 +262,3 @@ 'old-rule', | ||
'plugin/foo-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
]); | ||
@@ -186,3 +269,8 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative); | ||
assert.deepEqual(ruleFinder.getCurrentRules(), ['bar-rule', 'foo-rule', 'scoped-plugin/foo-rule']); | ||
assertDeepEqual(ruleFinder.getCurrentRules(), [ | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'bar-rule', | ||
'foo-rule' | ||
]); | ||
}); | ||
@@ -192,6 +280,7 @@ | ||
const ruleFinder = getRuleFinder(specifiedFileRelative); | ||
assert.deepEqual(ruleFinder.getCurrentRulesDetailed(), { | ||
assertDeepEqual(ruleFinder.getCurrentRulesDetailed(), { | ||
'@scope/foo-rule': [2], | ||
'@scope/scoped-plugin/foo-rule': [2], | ||
'bar-rule': [2], | ||
'foo-rule': [2], | ||
'scoped-plugin/foo-rule': [2] | ||
'foo-rule': [2] | ||
}); | ||
@@ -202,8 +291,10 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative); | ||
assert.deepEqual(ruleFinder.getPluginRules(), [ | ||
assertDeepEqual(ruleFinder.getPluginRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule' | ||
'plugin/foo-rule' | ||
]); | ||
@@ -214,10 +305,13 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative, {includeDeprecated: true}); | ||
assert.deepEqual(ruleFinder.getPluginRules(), [ | ||
assertDeepEqual(ruleFinder.getPluginRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
]); | ||
@@ -228,5 +322,9 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative); | ||
assert.deepEqual( | ||
assertDeepEqual( | ||
ruleFinder.getAllAvailableRules(), | ||
[ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'bar-rule', | ||
@@ -237,5 +335,3 @@ 'baz-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule' | ||
'plugin/foo-rule' | ||
] | ||
@@ -247,10 +343,12 @@ ); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative, {omitCore: true}); | ||
assert.deepEqual( | ||
assertDeepEqual( | ||
ruleFinder.getAllAvailableRules(), | ||
[ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule' | ||
'plugin/foo-rule' | ||
] | ||
@@ -262,5 +360,11 @@ ); | ||
const ruleFinder = getRuleFinder(specifiedFileRelative, {includeDeprecated: true}); | ||
assert.deepEqual( | ||
assertDeepEqual( | ||
ruleFinder.getAllAvailableRules(), | ||
[ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'bar-rule', | ||
@@ -273,6 +377,3 @@ 'baz-rule', | ||
'plugin/foo-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
] | ||
@@ -284,8 +385,9 @@ ); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), [ | ||
assertDeepEqual(ruleFinder.getUnusedRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'baz-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule' | ||
'plugin/foo-rule' | ||
]); | ||
@@ -296,3 +398,7 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute, {includeDeprecated: true}); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), [ | ||
assertDeepEqual(ruleFinder.getUnusedRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'baz-rule', | ||
@@ -303,5 +409,3 @@ 'old-rule', | ||
'plugin/foo-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
]); | ||
@@ -312,3 +416,8 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute); | ||
assert.deepEqual(ruleFinder.getCurrentRules(), ['bar-rule', 'foo-rule', 'scoped-plugin/foo-rule']); | ||
assertDeepEqual(ruleFinder.getCurrentRules(), [ | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'bar-rule', | ||
'foo-rule' | ||
]); | ||
}); | ||
@@ -318,6 +427,7 @@ | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute); | ||
assert.deepEqual(ruleFinder.getCurrentRulesDetailed(), { | ||
assertDeepEqual(ruleFinder.getCurrentRulesDetailed(), { | ||
'@scope/foo-rule': [2], | ||
'@scope/scoped-plugin/foo-rule': [2], | ||
'foo-rule': [2], | ||
'bar-rule': [2], | ||
'scoped-plugin/foo-rule': [2] | ||
'bar-rule': [2] | ||
}); | ||
@@ -328,8 +438,10 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute); | ||
assert.deepEqual(ruleFinder.getPluginRules(), [ | ||
assertDeepEqual(ruleFinder.getPluginRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule' | ||
'plugin/foo-rule' | ||
]); | ||
@@ -340,10 +452,13 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute, {includeDeprecated: true}); | ||
assert.deepEqual(ruleFinder.getPluginRules(), [ | ||
assertDeepEqual(ruleFinder.getPluginRules(), [ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'plugin/bar-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
]); | ||
@@ -354,5 +469,9 @@ }); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute); | ||
assert.deepEqual( | ||
assertDeepEqual( | ||
ruleFinder.getAllAvailableRules(), | ||
[ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'bar-rule', | ||
@@ -363,5 +482,3 @@ 'baz-rule', | ||
'plugin/baz-rule', | ||
'plugin/foo-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule' | ||
'plugin/foo-rule' | ||
] | ||
@@ -373,5 +490,11 @@ ); | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute, {includeDeprecated: true}); | ||
assert.deepEqual( | ||
assertDeepEqual( | ||
ruleFinder.getAllAvailableRules(), | ||
[ | ||
'@scope/bar-rule', | ||
'@scope/foo-rule', | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/bar-rule', | ||
'@scope/scoped-plugin/foo-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'bar-rule', | ||
@@ -384,6 +507,3 @@ 'baz-rule', | ||
'plugin/foo-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/bar-rule', | ||
'scoped-plugin/foo-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
] | ||
@@ -395,3 +515,3 @@ ); | ||
const ruleFinder = getRuleFinder(noRulesFile); | ||
assert.deepEqual(ruleFinder.getPluginRules(), [ | ||
assertDeepEqual(ruleFinder.getPluginRules(), [ | ||
'plugin/bar-rule', | ||
@@ -405,3 +525,3 @@ 'plugin/baz-rule', | ||
const ruleFinder = getRuleFinderForDedupeTests(noDuplicateRulesFiles); | ||
assert.deepEqual(ruleFinder.getAllAvailableRules(), [ | ||
assertDeepEqual(ruleFinder.getAllAvailableRules(), [ | ||
'bar-rule', | ||
@@ -416,3 +536,3 @@ 'foo-rule', | ||
const ruleFinder = getRuleFinderForDedupeTests(noDuplicateRulesFiles); | ||
assert.deepEqual(ruleFinder.getUnusedRules(), [ | ||
assertDeepEqual(ruleFinder.getUnusedRules(), [ | ||
'bar-rule', | ||
@@ -425,3 +545,3 @@ 'plugin/duplicate-foo-rule' | ||
const ruleFinder = getRuleFinder(specifiedFileAbsolute); | ||
assert.deepEqual(ruleFinder.getDeprecatedRules(), []); | ||
assertDeepEqual(ruleFinder.getDeprecatedRules(), []); | ||
}); | ||
@@ -431,8 +551,9 @@ | ||
const ruleFinder = getRuleFinder(usingDeprecatedRulesFile); | ||
assert.deepEqual(ruleFinder.getDeprecatedRules(), [ | ||
assertDeepEqual(ruleFinder.getDeprecatedRules(), [ | ||
'@scope/old-plugin-rule', | ||
'@scope/scoped-plugin/old-plugin-rule', | ||
'old-rule', | ||
'plugin/old-plugin-rule', | ||
'scoped-plugin/old-plugin-rule' | ||
'plugin/old-plugin-rule' | ||
]); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
80400
55
1846
0
8
8
+ Addedglob@^7.1.4
+ Addedacorn@7.4.1(transitive)
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcli-width@3.0.0(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedemoji-regex@8.0.0(transitive)
+ Addedeslint@6.8.0(transitive)
+ Addedeslint-scope@5.1.1(transitive)
+ Addedespree@6.2.1(transitive)
+ Addedfigures@3.2.0(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedglobals@12.4.0(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedinquirer@7.3.3(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-fullwidth-code-point@3.0.0(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedmute-stream@0.0.8(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedstring-width@4.2.3(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedtype-fest@0.21.30.8.1(transitive)
+ Addedv8-compile-cache@2.4.0(transitive)
- Removedacorn@6.4.2(transitive)
- Removedansi-escapes@3.2.0(transitive)
- Removedcli-cursor@2.1.0(transitive)
- Removedcli-width@2.2.1(transitive)
- Removedeslint@5.16.0(transitive)
- Removedeslint-scope@4.0.3(transitive)
- Removedespree@5.0.1(transitive)
- Removedfigures@2.0.0(transitive)
- Removedglobals@11.12.0(transitive)
- Removedinquirer@6.5.2(transitive)
- Removedmute-stream@0.0.7(transitive)
- Removedonetime@2.0.1(transitive)
- Removedpath-is-inside@1.0.2(transitive)
- Removedrestore-cursor@2.0.0(transitive)
- Removedstrip-json-comments@2.0.1(transitive)