eslint-config-lffg v1.6.0-1
eslint-config-lffg
My default ESLint (with Prettier) configuration.
Important code style info:
- 2 spaces for indentation;
- Single quotes;
- Semicolons as required.
What it does
- Lints JavaScript based on the latest standards;
- Formats the code with Prettier;
- Lints and fixes erros in HTML script tags;
- You can see all the rules here.
Installing
You can use ESLint globally and/or locally per project.
Per Project Install
If you don't already have a
package.jsonfile, create one withyarn init -y.Then install everything needed by the config:
yarn add eslint eslint-config-lffg --dev- Create a
.eslintrc.jsonfile in the root of your project's directory (it should live where package.json does). Your.eslintrc.jsonfile should look like this:
{
"extends": ["lffg"]
}- Optional You can add two scripts to your
package.jsonto lint and fix:
"scripts": {
"lint": "eslint . --ext .jsx,.js,.ts,.tsx",
"lint:fix": "yarn lint --fix"
},- Now you can manually lint your code by running
yarn lintand fix all fixable issues withyarn lint:fix. You probably want your editor to do this though.
Global Install
- First install everything needed:
yarn global add eslint eslint-config-lffg- Then you need to make a global
.eslintrc.jsonfile:
ESLint will look for one in your home directory.
~/.eslintrc.jsonfor Mac; or:C:\Users\<user>\.eslintrc.jsonfor Windows.
Your .eslintrc.json file should look like this:
{
"extends": ["lffg"]
}- To use from the CLI, you can now run
eslint .or configure your editor as we show next.
Integration With VS Code
Once you have done the installation, you probably want your editor to lint and fix for you. Here are the instructions for VS Code:
- Install the ESLint extension;
- Open the VSCode settings in
Code/File→Preferences→Settings. It's easier to enter these settings while editing thesettings.jsonfile, so click the{}icon in the top right corner:
"javascript.format.enable": false,
"editor.formatOnSave": true,
"[javascript]": {
"editor.formatOnSave": false
},
"[javascriptreact]": {
"editor.formatOnSave": false
},
"eslint.autoFixOnSave": true,
// 🛑 If you're using Yarn:
"eslint.packageManager": "yarn",
// 🛑 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.
"prettier.disableLanguages": [
"javascript",
"javascriptreact",
"typescript",
"typescriptreact"
],Extra Rules Configuration
If you'd like to overwrite ESLint or Prettier rules, you can add the rules in your .eslintrc.json file:
{
"extends": ["lffg"],
"rules": {
// Your ESLint rules here.
// <https://eslint.org/docs/rules/>
"prettier/prettier": [
"error",
{
// Your Prettier options here.
// <https://prettier.io/docs/en/options.html>
}
]
}
}This package is released under the MIT License.
This is a fork of eslint-config-wesbos and heavily inspired by the eslint-config-react-app rules.
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago