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

eslint-plugin-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-wrapper - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3-0

30

index.js

@@ -129,3 +129,6 @@ class EslintPluginWrapper {

/** Given a rule info, get the correct string reference for it in a config (i.e. must include this plugin's name prefix) */
/**
* Given a rule info, get the correct string reference for it in a config (i.e. must include this plugin's name prefix)
* @param {RuleInfo} info
*/
configRuleReference(info) {

@@ -183,6 +186,4 @@ return `${this.pluginName}/${info.pluginName}/${info.ruleName}`

return Object.fromEntries(
Object.entries(config.rules).map(([key, val]) =>
key.startsWith(pluginName)
? [`${this.pluginName}/${key}`, val]
: [key, val],
Object.entries(config.rules).map(entry =>
this.prefixConfigRule(entry),
),

@@ -227,6 +228,4 @@ )

rules: Object.fromEntries(
Object.entries(config.rules).map(([key, val]) =>
key.startsWith(pluginName)
? [`${this.pluginName}/${key}`, val]
: [key, val],
Object.entries(config.rules).map(entry =>
this.prefixConfigRule(entry),
),

@@ -243,2 +242,9 @@ ),

prefixConfigRule([key, val]) {
const matchingPlugin = Object.keys(this.plugins).find(name =>
key.startsWith(`${name}/`),
)
return matchingPlugin ? [`${this.pluginName}/${key}`, val] : [key, val]
}
buildProcessors() {

@@ -259,6 +265,8 @@ return Object.assign(

/** @typedef {{pluginName: string; plugin: import('.').Plugin; ruleName: string; rule: import('eslint').Rule.RuleModule}} RuleInfo */
/**
* For a dictionary of plugins and a function to get entries, build a dictionary of rules.
*
* @type {<T>(plugins: Record<string, import('.').Plugin>, getEntry: (opts: {pluginName: string; plugin: import('.').Plugin; ruleName: string; rule: import('eslint').Rule.RuleModule}) => [string, T]) => Record<string, T>}
* @type {<T>(plugins: Record<string, import('.').Plugin>, getEntry: (opts: RuleInfo) => [string, T]) => Record<string, T>}
*/

@@ -271,3 +279,3 @@ function ruleDict(plugins, getEntry) {

Object.entries(plugin.rules || {}).map(([ruleName, rule]) =>
getEntry({pluginName, pluginName, ruleName, rule}),
getEntry({pluginName, ruleName, rule}),
),

@@ -274,0 +282,0 @@ ),

{
"name": "eslint-plugin-wrapper",
"version": "0.0.2",
"version": "0.0.3-0",
"description": "Write project-specific rules, in your own eslint config file",

@@ -13,3 +13,3 @@ "main": "index.js",

"lint": "eslint .",
"test": "npm run lint"
"test": "jest"
},

@@ -16,0 +16,0 @@ "repository": {

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