Skip to content

1024pix/eslint-plugin

Repository files navigation

@1024pix/eslint-plugin

npm

Usage

Install

npm install --save-dev eslint@^8 @1024pix/eslint-plugin

Config eslint.config.cjs

const pixEslintConfig = require('@1024pix/eslint-plugin/config');

module.exports = pixEslintConfig;

Note that this ESLint config is not ready to use with ESM.

Add script for package.json

For example:

{
  "scripts": {
    "lint": "eslint .",
    "lint:fix": "eslint . --fix"
  }
}

Config VS Code auto fix

Install VS Code ESLint extension and create .vscode/settings.json

{
  "prettier.enable": false,
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true,
    "source.organizeImports": false
  }
}

FAQ

I prefer XXX...

Sure, you can override the rules in your eslint.config.js file.

const pixEslintConfig = require('@1024pix/eslint-plugin/config');

module.exports = [
  ...eslintConfig,
  {
    rules: {
      // your rules...
    },
  },
];

Or you can always fork this repo and make your own.

Migration guide

v1.2.0

Before v1.2.0, Pix Config was provided by the @1024pix/eslint-config project.

After upgrading, you should migrate from the old .eslintrc files to the new eslint.config.cjs file format.

Take a look at the official ESLint migration guide. You can also take inspiration from this Pix context example.

Once finished, @1024pix/eslint-config can safely be removed.