Skip to content
This repository was archived by the owner on Mar 23, 2025. It is now read-only.

owvy/repack-eslint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

repack-eslint

Repack eslint dependencies supporting plugins as dependencies in shareable config.

Eslint does not resolve plugins from sharable configuration, forcing the project to have all the dependencies installed. repack-eslint is a way around that.

Quickstart

npm install @owvy/repack-eslint

Usage Examples:

  1. How does it work?
  2. Important Details

How does it work

It basically convert your config to a plugin and import all the rules from its dependencies.

  • Standard config file:
// package: eslint-config-simple

module.exports = {
  plugins: ['prettier']
  rules: {
      "prettier/prettier": "error"
  }

// project: eslintrc.js

  module.exports = {
    extends: ['simple']
  }
}
  • Config/Plugin with eslint-repack:
// package: eslint-plugin-simple

const myConfig = repackConfig(require("./eslint-config-simple"), {
  pluginName: "simple",
  nodeModulesDir: path.join(__dirname, "node_modules"),
});

module.exports = {
  rules: myConfig.rules,
  configs: {
    all: myConfig.config,
  },
};

// project: eslintrc.js

  module.exports = {
    extends: ['plugin:simple/all'],
    plugins: ['simple']
  }
}

Basic Usage

If you are planning to add new rules or override any of rules that is coming from the plugin, you will need to add your plugin name as prefix:

// Prettier used on: eslint-plugin-simple
{
  ...
  rules: {
      "simple/prettier/prettier": "error"
  }
}
PR, Comments & feedback are welcome :)

About

support plugins as dependencies in shareable config.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors