eslint-plugin-ava
Advanced tools
Comparing version 10.0.1 to 10.1.0
{ | ||
"name": "eslint-plugin-ava", | ||
"version": "10.0.1", | ||
"version": "10.1.0", | ||
"description": "ESLint rules for AVA", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
'use strict'; | ||
const path = require('path'); | ||
const espurify = require('espurify'); | ||
@@ -27,14 +28,25 @@ const deepStrictEqual = require('deep-strict-equal'); | ||
const create = context => ({ | ||
ImportDeclaration: node => { | ||
if (node.source.value === 'ava' && node.specifiers[0].local.name !== 'test') { | ||
report(context, node); | ||
const create = context => { | ||
const ext = path.extname(context.getFilename()); | ||
const isTypeScript = ext === '.ts' || ext === '.tsx'; | ||
return { | ||
ImportDeclaration: node => { | ||
if (node.source.value === 'ava') { | ||
const {name} = node.specifiers[0].local; | ||
if (name !== 'test' && (!isTypeScript || name !== 'anyTest')) { | ||
report(context, node); | ||
} | ||
} | ||
}, | ||
VariableDeclarator: node => { | ||
if (node.init && deepStrictEqual(espurify(node.init), avaVariableDeclaratorInitAst)) { | ||
const {name} = node.id; | ||
if (name !== 'test' && (!isTypeScript || name !== 'anyTest')) { | ||
report(context, node); | ||
} | ||
} | ||
} | ||
}, | ||
VariableDeclarator: node => { | ||
if (node.id.name !== 'test' && node.init && deepStrictEqual(espurify(node.init), avaVariableDeclaratorInitAst)) { | ||
report(context, node); | ||
} | ||
} | ||
}); | ||
}; | ||
}; | ||
@@ -41,0 +53,0 @@ module.exports = { |
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
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
60633
2201