1.3.0 • Published 1 year ago

@cneuro/eslint-config-alpha v1.3.0

Weekly downloads
-
License
gpl-3.0
Repository
github
Last release
1 year ago

eslint-config-alpha

This is a shareable linting configuration library for projects based on React 18 with Typescript 4 utilizing ESLint.

It is an exhaustive and opinionated configuration that cares about details like alphabetic ordering of keys and enums, enforcing consistent use of brackets and prohibiting default exports.

Installation

First, install this package alongside eslint:

npm install -D @cneuro/eslint-config-alpha eslint

Next, create the .eslintrc.json configuration file at the root of your project:

{
  "extends": "@cneuro/eslint-config-alpha",
}

Remember to set here any ignorePatterns if you require them beyond the standard build and dist folders, along with any other config overrides.

Usage

Once installed, you can run any eslint command.

You may also define scripts that will lint, fix and format your files to help automate your workflow.

For example, in your package.json, add the following under scripts:

"scripts": {
  "lint-code": "eslint --fix --ext .ts,.tsx .",
}

IDE setup

VS Code

If you use Microsoft VS Code, you can add the following snippet at the top of your .vscode/settings.json to automatically run eslint and fix all issues whenever a file is saved.

"editor.codeActionsOnSave": {
  "source.fixAll.eslint": true
}

License

This work is licensed under the GNU General Public License version 3.