🐷
【eslint】or条件のpathを追加
コード
package.json
{
"name": "next-various",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"check-types": "tsc --noEmit",
"lint": "eslint --ext .jsx,.js,.tsx,.ts pages/**/*",
"lint:fix": "eslint \"pages/**/*.{ts,tsx}\" --fix",
"fmt": "prettier --write pages/**/*",
"test-all": "npx yarn-run-all lint check-types format lint:fix",
"lints": "yarn fmt && yarn lint:fix"
},
// 〜略〜
package.json
{
"name": "next-various",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"check-types": "tsc --noEmit",
"lint": "eslint --ext .jsx,.js,.tsx,.ts {pages,components}/**/*",
"lint:fix": "eslint \"{pages,components}/**/*.{ts,tsx}\" --fix",
"fmt": "prettier --write {pages,components}/**/*",
"test-all": "npx yarn-run-all lint check-types format lint:fix",
"lints": "yarn fmt && yarn lint:fix"
},
// 〜略〜
説明
{}
で囲んで、 ,
で区切ればor条件にできる。
{pages,components}/**/*.{ts,tsx}
だったら、
pages/**/*.ts
pages/**/*.tsx
components/**/*.ts
components/**/*.tsx
を選択しているのと同義。
Discussion