@volusion/eslint-config

Shareable ESLint config for typescript

Usage no npm install needed!

<script type="module">
  import volusionEslintConfig from 'https://cdn.skypack.dev/@volusion/eslint-config';
</script>

README

Volusion ESLint Configs

Shareable ESLint configuration files

How to use it

  1. Install the package as a development dependency:
npm install --save-dev @volusion/eslint-config
  1. Create an eslint config file in your project, with @volusion/eslint-config as an extension.

.eslintrc.js:

module.exports = {
    "extends": [
        "@volusion/eslint-config"
    ],
    "rules": {
        // Place custom overrides for your project here.
    }
}

Advanced Usage

To use something other than the default config, update your configuration to match the name of the config file in this repo that you want to extend.

For a typescript project, your config might look like this:

.eslintrc.js:

module.exports = {
    "extends": [
        "@volusion/eslint-config",
        "@volusion/eslint-config/typescript", // matches `typescript.js` in the root of this package.
        "@volusion/eslint-config/react", // for react projects, matches `react.js`
    ],
    "rules": {
        // Place custom overrides for your project here.
    }
}

Developer Guide

Modifying an existing config

All configs are located in the lib directory. Find the one you want to modify, and treat it like a standard eslint config file. Keep the individual config scopes small: don't put non-typescript rules in lib/typescript.js, for example.

Adding a new config

  1. Add your new config file to the lib directory. (i.e. ./lib/react.js)
  2. Add a file to the root of the project to import the config from lib. ./react.js
module.exports = require("./lib/react.js");

File Structure

  • Configs are located in ./lib/, then re-exported from the root for consumption by dependent packages. This lets dependents reference individual configs without having to know the file structure of this repo (e.g. @volusion/eslint-config/react instead of @volusion/eslint-config/lib/react).
  • ./.eslintrc.js and ./.prettierrc.js (with the preceeding .) are the local configuration files for linting and formatting this repo.