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

eslint-plugin-uilib

Package Overview
Dependencies
Maintainers
3
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-uilib - npm Package Compare versions

Comparing version 1.0.28 to 1.0.30

17

lib/rules/no-direct-import.js

@@ -5,9 +5,12 @@ const MAP_SCHEMA = {

origin: {
type: 'string',
type: 'string'
},
destination: {
type: 'string',
type: 'string'
},
applyAutofix: {
type: 'boolean'
}
},
additionalProperties: false,
additionalProperties: false
};

@@ -23,3 +26,3 @@

messages: {
uiLib: 'Do not import directly from this source. Please use another import source (autofix available).',
uiLib: 'Do not import directly from this source. Please use another import source (autofix may be available).',
},

@@ -36,3 +39,5 @@ fixable: 'code',

const destination = context.options[0].destination;
const message = `Do not import directly from '${origin}'. Please use '${destination}' (autofix available).`;
const applyAutofix = context.options[0].applyAutofix;
const autofixMessage = applyAutofix ? ' (autofix available)' : '';
const message = `Do not import directly from '${origin}'. Please use '${destination}'${autofixMessage}.`;
context.report({

@@ -42,3 +47,3 @@ node,

fix(fixer) {
if (node && destination) {
if (node && applyAutofix && destination) {
return fixer.replaceText(node.source, `'${destination}'`);

@@ -45,0 +50,0 @@ }

{
"name": "eslint-plugin-uilib",
"version": "1.0.28",
"version": "1.0.30",
"description": "uilib set of eslint rules",

@@ -10,3 +10,3 @@ "keywords": [

],
"author": "Tnbal Tish <inbalti@wix.com>",
"author": "Inbal Tish <inbalti@wix.com>",
"license": "MIT",

@@ -13,0 +13,0 @@ "publishConfig": {

const RuleTester = require('eslint').RuleTester;
const rule = require('../../../lib/rules/no-direct-import');
const ruleOptions = [{ origin: 'some-module', destination: 'another-module' }];
const ruleOptions = [{origin: 'some-module', destination: 'another-module', applyAutofix: true}];
RuleTester.setDefaultConfig({
parser: 'babel-eslint',
parserOptions: { ecmaVersion: 6, ecmaFeatures: { jsx: true } },
parserOptions: {ecmaVersion: 6, ecmaFeatures: {jsx: true}}
});

@@ -20,4 +20,4 @@

options: ruleOptions,
code: validExample,
},
code: validExample
}
],

@@ -30,6 +30,6 @@ invalid: [

errors: [
{ message: `Do not import directly from 'some-module'. Please use 'another-module' (autofix available).` },
],
},
],
{message: `Do not import directly from 'some-module'. Please use 'another-module' (autofix available).`}
]
}
]
});
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