ES Lint Init Options
Table of Contents
Install
# install eslint
# follow the prompts and create an .eslintrc.js
npx eslint --init
Prompts (short)
- ESLint Use
- Prompt:
How would you like to use ESLint? - Select:
To check syntax, find problems, and enforce code style
- Prompt:
- Type of Modules
- Prompt:
What type of modules does your project use? - Select:
JavaScript modules (import/export)
- Prompt:
- Framework
- Prompt:
Which framework does your project use? - Select:
React
- Prompt:
- Type of Modules
- Prompt:
Does your project use TypeScript? - Select:
Yes
- Prompt:
- Environment
- Prompt:
Where does your code run? - Select:
Browser
- Prompt:
- Style Guide
- Prompt:
How would you like to define a style for your project? - Select:
Use a popular style guide
- Prompt:
- Which Styleguide
- Prompt:
Which style guide do you want to follow? - Select:
❯ Airbnb: https://github.com/airbnb/javascript
- Prompt:
- Config Format
- Prompt:
What format do you want your config file to be in? - Select:
❯ JavaScript
- Prompt:
- Installing Additional Dependencies
- Prompt:
Would you like to install them now with npm? - Select:
Yes
- Prompt:
Prompts (Detailed)
1. ESLint Use
Prompt: How would you like to use ESLint?
Select: To check syntax, find problems, and enforce code style
? How would you like to use ESLint? …
To check syntax only
To check syntax and find problems
❯ To check syntax, find problems, and enforce code style
2. Type of Modules
Prompt: What type of modules does your project use?
Select: JavaScript modules (import/export)
what type of modules does your project use? …
❯ JavaScript modules (import/export)
CommonJS (require/exports)
None of these
3. Framework
Prompt: Which framework does your project use?
For most cases Select: React
Select: None of these if you are writing a Nodejs App
Select: Vue.js if you are writing a Vue.js App
? Which framework does your project use? …
❯ React
Vue.js
None of these
4. Type of Modules
Prompt: Does your project use TypeScript?
? Does your project use TypeScript? › No / Yes
5. Environment
Prompt: ```Where does your code run?
? Where does your code run? … (Press <space> to select, <a> to toggle all, <i> to invert selection)
✔ Browser
✔ Node
6. Style Guide
Prompt: How would you like to define a style for your project?
Select: Use a popular style guide
? How would you like to define a style for your project? …
❯ Use a popular style guide
Answer questions about your style
Inspect your JavaScript file(s)
7. Which Styleguide
Prompt: Which style guide do you want to follow?
Select: ❯ Airbnb: https://github.com/airbnb/javascript
? Which style guide do you want to follow? …
❯ Airbnb: https://github.com/airbnb/javascript
Standard: https://github.com/standard/standard
Google: https://github.com/google/eslint-config-google
8. Config Format
Prompt: What format do you want your config file to be in?
Select: ❯ JavaScript
? What format do you want your config file to be in? …
❯ JavaScript
YAML
JSON
Results
✔ How would you like to use ESLint? · style
✔ What type of modules does your project use? · esm
✔ Which framework does your project use? · react
✔ Does your project use TypeScript? · No / Yes
✔ Where does your code run? · browser
✔ How would you like to define a style for your project? · guide
✔ Which style guide do you want to follow? · airbnb
✔ What format do you want your config file to be in? · JavaScript
10. Installing Additional Dependencies
Prompt: Would you like to install them now with npm?
Select: Yes
? Would you like to install them now with npm? › No / Yes