You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

eslint-plugin-workspaces

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-workspaces - npm Package Compare versions

Comparing version

to
0.6.3-rc1

2

lib/index.js

@@ -12,2 +12,3 @@ 'use strict';

recommended: {
plugins: ['workspaces'],
rules: {

@@ -20,2 +21,3 @@ 'workspaces/no-relative-imports': 'error',

all: {
plugins: ['workspaces'],
rules: {

@@ -22,0 +24,0 @@ 'workspaces/no-relative-imports': 'error',

10

lib/rules/no-absolute-imports.js

@@ -11,7 +11,10 @@ 'use strict';

'disallow absolute imports for files that are within the current package',
url:
'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/no-absolute-imports.md',
url: 'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/no-absolute-imports.md',
},
fixable: 'code',
schema: [],
messages: {
noAbsoluteImports:
'Absolute imports within the current package are not allowed',
},
};

@@ -25,4 +28,3 @@

node,
message:
'Absolute imports within the current package are not allowed',
messageId: 'noAbsoluteImports',
fix: (fixer) =>

@@ -29,0 +31,0 @@ fixer.replaceTextRange(

@@ -9,4 +9,3 @@ 'use strict';

description: 'disallow imports of files that are inside another package',
url:
'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/no-cross-imports.md',
url: 'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/no-cross-imports.md',
},

@@ -46,18 +45,17 @@ schema: [

],
messages: { noCrossImports: 'Import from package "{{name}}" is not allowed' },
};
const filterSharedPackagesInCurrentScope = (
{ location: currentLocation },
scopedEnabled,
scopedSharingFolderName,
) => ({ location }) => {
if (!scopedEnabled) return true;
const locationArray = location.split('/');
const forbiddenPackageParent = locationArray.slice(0, -1).join('/');
if (!isSubPath(forbiddenPackageParent, currentLocation)) {
return true;
}
const filterSharedPackagesInCurrentScope =
({ location: currentLocation }, scopedEnabled, scopedSharingFolderName) =>
({ location }) => {
if (!scopedEnabled) return true;
const locationArray = location.split('/');
const forbiddenPackageParent = locationArray.slice(0, -1).join('/');
if (!isSubPath(forbiddenPackageParent, currentLocation)) {
return true;
}
return locationArray[locationArray.length - 1] !== scopedSharingFolderName;
};
return locationArray[locationArray.length - 1] !== scopedSharingFolderName;
};

@@ -91,3 +89,3 @@ module.exports.create = (context) => {

node,
message: 'Import from package "{{name}}" is not allowed',
messageId: 'noCrossImports',
data: { name },

@@ -94,0 +92,0 @@ });

@@ -10,7 +10,9 @@ 'use strict';

'disallow relative imports of files that are outside of the current package',
url:
'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/no-relative-imports.md',
url: 'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/no-relative-imports.md',
},
fixable: 'code',
schema: [],
messages: {
noRelativeImports: 'Relative imports of other packages are not allowed',
},
};

@@ -21,6 +23,10 @@

packages.forEach(({ name, location }) => {
if (name !== currentPackage.name && isSubPath(location, path)) {
if (
name !== path &&
name !== currentPackage.name &&
isSubPath(location, path)
) {
context.report({
node,
message: 'Relative imports of other packages are not allowed',
messageId: 'noRelativeImports',
fix: (fixer) =>

@@ -27,0 +33,0 @@ fixer.replaceTextRange(

@@ -10,6 +10,9 @@ 'use strict';

'disallow importing from packages that are not listed as a dependency',
url:
'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/require-dependency.md',
url: 'https://github.com/joshuajaco/eslint-plugin-workspaces/blob/master/docs/rules/require-dependency.md',
},
schema: [],
messages: {
requireDependency:
'Importing from another workspace without listing it as a dependency is not allowed',
},
};

@@ -30,4 +33,3 @@

node,
message:
'Importing from another workspace without listing it as a dependency is not allowed',
messageId: 'requireDependency',
});

@@ -34,0 +36,0 @@ }

{
"name": "eslint-plugin-workspaces",
"version": "0.6.2",
"version": "0.6.3-rc1",
"main": "lib/index.js",

@@ -35,3 +35,3 @@ "license": "MIT",

"test": "yarn lint && nyc yarn mocha",
"coverage": "nyc report --reporter=text-lcov | coveralls",
"coverage": "mkdir -p coverage && touch ./coverage/lcov.info && nyc report --reporter=text-lcov > ./coverage/lcov.info",
"lint": "eslint . --ignore-path .gitignore",

@@ -46,12 +46,11 @@ "lint:fix": "yarn lint --fix"

"babel-eslint": "^10.1.0",
"coveralls": "^3.1.0",
"eslint": "^7.7.0",
"eslint-plugin-eslint-plugin": "^2.3.0",
"eslint": "^7.32.0",
"eslint-plugin-eslint-plugin": "^3.6.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.1.4",
"mocha": "^8.1.1",
"eslint-plugin-prettier": "^4.0.0",
"mocha": "^9.1.2",
"mock-require": "^3.0.3",
"nyc": "^15.1.0",
"prettier": "^2.0.5"
"prettier": "^2.4.1"
}
}

@@ -1,2 +0,2 @@

# eslint-plugin-workspaces [![Build Status](https://travis-ci.com/joshuajaco/eslint-plugin-workspaces.svg?branch=master)](https://travis-ci.com/joshuajaco/eslint-plugin-workspaces/) [![Coverage Status](https://coveralls.io/repos/github/joshuajaco/eslint-plugin-workspaces/badge.svg)](https://coveralls.io/github/joshuajaco/eslint-plugin-workspaces) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
# eslint-plugin-workspaces [![Coverage Status](https://coveralls.io/repos/github/joshuajaco/eslint-plugin-workspaces/badge.svg)](https://coveralls.io/github/joshuajaco/eslint-plugin-workspaces) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)

@@ -3,0 +3,0 @@ An ESLint plugin for enforcing consistent imports across monorepo packages.