ESLint Setting
記錄一些自己常用的 ESLint 設定
version:
eslint@8.47.0
eslint-config-next@13.4.13
Extends
next/core-web-vitals
為 init next 的 default 配置
More info: Core Web Vitals
Rules
semi
Require or disallow semicolons instead of ASI (automatic semicolon insertion)
取消每段 statement 末尾的分號
1 |
|
member-delimiter-style
Require a specific member delimiter style for interfaces and type literals
取消 interface/type 末尾的分號
1 |
|
quotes
Enforce the consistent use of either backticks, double, or single quotes
使用單引號
1 |
|
object-curly-spacing
Enforce consistent spacing inside braces
大括號內的間距一致,包和物件中的物件和陣列
1 |
|
block-spacing
Disallow or enforce spaces inside of blocks after opening block and before closing block
大括號後需要空格
1 |
|
Plugins
eslint-plugin-simple-import-sort
Easy autofixable import sorting
Add “simple-import-sort” to “plugins”
1 |
|
Then add the rules for sorting imports and exports:
1 |
|
ESLint Setting
http://example.com/2023/08/13/ESLint-Setting/