Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lokalise/eslint-plugin

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lokalise/eslint-plugin - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

docs/rules/relative-internal-imports.md

2

package.json
{
"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;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc