eslint-plugin-quintoandar
Advanced tools
Comparing version 1.5.4 to 1.5.5
{ | ||
"name": "eslint-plugin-quintoandar", | ||
"version": "1.5.4", | ||
"version": "1.5.5", | ||
"description": "An eslint-plugin for PWA-Tenants custom rules", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,2 +0,3 @@ | ||
const notAllowedPath = 'assets/themes/'; | ||
const firstPath = 'assets/themes/'; | ||
const secondPath = 'assets/values/theme'; | ||
@@ -9,5 +10,6 @@ const reportText = ` | ||
module.exports = function noThemeImport(context) { | ||
const checkString = (node, string) => node.indexOf(string) >= 0; | ||
return { | ||
ImportDeclaration(node) { | ||
if (node.source.value.indexOf(notAllowedPath) >= 0) { | ||
if (checkString(node.source.value, firstPath) || checkString(node.source.value, secondPath)) { | ||
context.report({ | ||
@@ -14,0 +16,0 @@ node, |
@@ -32,5 +32,5 @@ | ||
ruleTester.run('no-theme-import', rule, { | ||
valid: [ | ||
{ code: "import withTheme from '@material-ui/core/styles/withTheme'" }, | ||
], | ||
valid: [{ | ||
code: "import withTheme from '@material-ui/core/styles/withTheme'" | ||
}], | ||
invalid: [{ | ||
@@ -40,8 +40,14 @@ code: "import theme from 'assets/themes/blue'", | ||
}, { | ||
code: "import theme from 'block-party/assets/themes/light-v1'", | ||
code: "import theme from 'block-party/assets/themes/blue'", | ||
errors, | ||
}, { | ||
code: "import theme from 'block-party/assets/themes/blue'", | ||
code: "import theme from 'block-party/assets/themes/green'", | ||
errors, | ||
}, { | ||
code: "import theme from 'block-party/assets/values/theme'", | ||
errors, | ||
}, { | ||
code: "import theme from 'assets/values/theme'", | ||
errors, | ||
}] | ||
}); |
34584
736