@lokalise/eslint-plugin
Advanced tools
Comparing version 1.4.0 to 1.5.0
{ | ||
"name": "@lokalise/eslint-plugin", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "ESLint plugin for Lokalise", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -38,2 +38,3 @@ # eslint-plugin | ||
"@lokalise/package-boundary": "error", | ||
"@lokalise/relative-internal-imports": "error" | ||
} | ||
@@ -64,2 +65,3 @@ } | ||
* [@lokalise/package-boundary](docs/rules/package-boundary.md): Ensures all the imports and exports happen through index. | ||
* [@lokalise/relative-internal-imports](docs/rules/relative-internal-imports.md): Ensures module internal imports are relative. | ||
@@ -66,0 +68,0 @@ ## License |
/* eslint-disable */ | ||
const { dirname, relative, sep, join } = require('path'); | ||
const { dirname, relative, sep } = require('path'); | ||
@@ -14,2 +14,3 @@ const { default: moduleVisitor, makeOptionsSchema } = require('eslint-module-utils/moduleVisitor'); | ||
schema: [makeOptionsSchema()], | ||
hasSuggestions: true, | ||
}, | ||
@@ -43,3 +44,3 @@ | ||
currentPath.push(path); | ||
const importPath = join(...currentPath) | ||
const importPath = currentPath.join(sep) | ||
@@ -62,3 +63,3 @@ if (path === '..') { | ||
const normalisedRelativeImportPath = join('.', relativeImportPath).toLowerCase(); | ||
const normalisedRelativeImportPath = ['.', relativeImportPath].join(sep).toLowerCase(); | ||
if (isRelativeImport && normalisedRelativeImportPath.indexOf(importPath.toLowerCase() + sep) !== 0) { | ||
@@ -76,3 +77,11 @@ // In case resolved import path is NOT index file inside desired directory | ||
node: sourceNode, | ||
message: `Passing module boundary. Should import from \`${recommendedImportPath}\`.`, | ||
message: 'Passing module boundary', | ||
suggest: [ | ||
{ | ||
desc: `Change import to \`${recommendedImportPath}\``, | ||
fix: function(fixer) { | ||
return fixer.replaceTextRange(sourceNode.range, `"${recommendedImportPath}"`); | ||
} | ||
} | ||
] | ||
}); | ||
@@ -79,0 +88,0 @@ break; |
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
11895
9
145
71