@hallarhq/eslint-config
v3.1.0
Published
eslint=config-hallar
Downloads
4
Readme
Table of Contents
Installation
This module should be installed as one of your project's devDependencies
:
npx install-peerdeps --dev eslint-config
Usage
Then add the extends to your .eslintrc.js:
module.exports = {
extends: "hallar",
rules: {
// your overrides
},
};
Other configs
You can use other configs in combination with the main eslint.
module.exports = {
extends: ['hallar', 'hallar/<config-name>'],
}
React example
module.exports = {
extends: [
'hallar',
'hallar/react',
'hallar/jsx-a11y',
],
rules: {
// your overrides
},
};
VS Code
Using the eslint-plugin you can use these settings for autoformatting:
"editor.formatOnSave": true,
"eslint.format.enable": true,
"[javascript]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[javascriptreact]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescript]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[typescriptreact]": {
"editor.formatOnSave": false,
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"editor.codeActionsOnSave": {
"source.fixAll": true,
}
With JetBrains Products (IntelliJ IDEA, WebStorm, RubyMine, PyCharm, PhpStorm, etc)
If you have previously configured ESLint to run via a File Watcher, turn that off.
If you choose Local / Per Project Install Above
- Open ESLint configuration by going to File > Settings (Edit > Preferences on Mac) > Languages & Frameworks > Code Quality Tools > ESLint (optionally just search settings for "eslint")
- Select Automatic ESLint Configuration
- Check Run eslint --fix on save
If you choose Global Install
The following steps are for a typical Node / ESLint global installtion. If you have a customized setup, refer to JetBrains docs for more ESLint Configuration Options.
- Open ESLint configuration by going to File > Settings (Edit > Preferences on Mac) > Languages & Frameworks > Code Quality Tools > ESLint (optionally just search settings for "eslint")
- Select Manual ESLint configuration
- Choose your Node interpreter from the detected installations
- Select the global ESLint package from the dropdown
- Leave Configuration File as Automatic Search
- Check Run eslint --fix on save
Ensure the Prettier plugin is disabled if installed.
- Open Prettier configuration by going to File > Settings (Edit > Preferences on Mac) > Languages & Frameworks > Code Quality Tools > Prettier (optionally just search settings for "prettier")
- Uncheck both On code reformat and On save
- Optional BUT IMPORTANT: If you have the Prettier extension enabled for other languages like CSS and HTML, turn it off for JS since we are doing it through Eslint already.
- Make sure the Run for files glob does not include
js,ts,jsx,tsx
. - An example glob for styles, config, and markdown.
{**/*,*}.{yml,css,sass,md}
- Make sure the Run for files glob does not include