Bump packages to fix linter
This commit is contained in:
parent
ed9506bbaf
commit
0a11e3fdd9
6063 changed files with 378752 additions and 306784 deletions
37
node_modules/eslint-plugin-no-only-tests/rules/no-only-tests.js
generated
vendored
37
node_modules/eslint-plugin-no-only-tests/rules/no-only-tests.js
generated
vendored
|
|
@ -9,8 +9,11 @@
|
|||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const BLOCK_DEFAULTS = ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial'];
|
||||
const FOCUS_DEFAULTS = ['only'];
|
||||
const defaultOptions = {
|
||||
block: ['describe', 'it', 'context', 'test', 'tape', 'fixture', 'serial', 'Feature', 'Scenario', 'Given', 'And', 'When', 'Then'],
|
||||
focus: ['only'],
|
||||
fix: false,
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
|
|
@ -31,6 +34,7 @@ module.exports = {
|
|||
type: 'string',
|
||||
},
|
||||
uniqueItems: true,
|
||||
default: defaultOptions.block,
|
||||
},
|
||||
focus: {
|
||||
type: 'array',
|
||||
|
|
@ -38,9 +42,11 @@ module.exports = {
|
|||
type: 'string',
|
||||
},
|
||||
uniqueItems: true,
|
||||
default: defaultOptions.focus,
|
||||
},
|
||||
fix: {
|
||||
type: 'boolean',
|
||||
default: defaultOptions.fix,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
|
|
@ -48,20 +54,27 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
create(context) {
|
||||
var block = (context.options[0] || {}).block || BLOCK_DEFAULTS;
|
||||
var focus = (context.options[0] || {}).focus || FOCUS_DEFAULTS;
|
||||
var fix = !!(context.options[0] || {}).fix;
|
||||
const options = Object.assign({}, defaultOptions, context.options[0]);
|
||||
const blocks = options.block || [];
|
||||
const focus = options.focus || [];
|
||||
const fix = !!options.fix;
|
||||
|
||||
return {
|
||||
Identifier(node) {
|
||||
var parentObject = node.parent && node.parent.object;
|
||||
const parentObject = node.parent && node.parent.object;
|
||||
if (parentObject == null) return;
|
||||
if (focus.indexOf(node.name) === -1) return;
|
||||
|
||||
var callPath = getCallPath(node.parent).join('.');
|
||||
const callPath = getCallPath(node.parent).join('.');
|
||||
|
||||
// comparison guarantees that matching is done with the beginning of call path
|
||||
if (block.find(b => callPath.split(b)[0] === '')) {
|
||||
if (
|
||||
blocks.find(block => {
|
||||
// Allow wildcard tail matching of blocks when ending in a `*`
|
||||
if (block.endsWith('*')) return callPath.startsWith(block.replace(/\*$/, ''));
|
||||
return callPath.startsWith(`${block}.`);
|
||||
})
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
message: callPath + ' not permitted',
|
||||
|
|
@ -76,12 +89,8 @@ module.exports = {
|
|||
function getCallPath(node, path = []) {
|
||||
if (node) {
|
||||
const nodeName = node.name || (node.property && node.property.name);
|
||||
if (node.object) {
|
||||
return getCallPath(node.object, [nodeName, ...path]);
|
||||
}
|
||||
if (node.callee) {
|
||||
return getCallPath(node.callee, path);
|
||||
}
|
||||
if (node.object) return getCallPath(node.object, [nodeName, ...path]);
|
||||
if (node.callee) return getCallPath(node.callee, path);
|
||||
return [nodeName, ...path];
|
||||
}
|
||||
return path;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue