> npx eslint src/** *.{js,jsx,ts,tsx} --fix
Oops! Something went wrong! :(
ESLint: 8.57.0
You are linting "src/api", but all of the files matching the glob pattern "src/api" are ignored.
If you don't want to lint these files, remove the pattern "src/api" from the list of arguments passed to ESLint.
工作流程:
name: GitHub Actions Demo
run-name: ${{ github.actor }} is testing out GitHub Actions 🚀
on:
push:
branches:
- deploy
jobs:
everything:
runs-on: ubuntu-latest
# container:
# image: cypress/included
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cypress install
uses: cypress-io/github-action@v6
with:
# Disable running of tests within install job
runTests: false
build: npm install
- name: Cypress run
uses: cypress-io/github-action@v6
with:
start: npm run dev
- name: Run ESLint
run: npm run lint
- name: Update Schema
run: npm run updateSchema
- name: deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import eslintPluginUnicorn from "eslint-plugin-unicorn";
import eslintConfigPrettier from "eslint-config-prettier";
export default [
{languageOptions: { globals: globals.browser }},
pluginJs.configs.recommended,
eslintPluginUnicorn.configs['flat/recommended'],
// ...tseslint.configs.recommended,
// ...tseslint.configs.recommendedTypeChecked,
{
languageOptions: {
globals: globals.browser,
parserOptions: {
project: true,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
// "@typescript-eslint/no-floating-promises": "error",
"unicorn/filename-case": [
"error",
{
case: "camelCase",
},
],
},
},
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// pluginJs.configs.recommended,
// // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
// eslintPluginUnicorn.configs["flat/recommended"],
// // //...tseslint.configs.recommended,
// // ...tseslint.configs.recommendedTypeChecked,
// eslintConfigPrettier,
];
1/ 修改
package.json
:
lint
脚本中有一个拼写错误:
** *
而不是
**/*
eslint.config.mjs
文件的路径,以防止特定环境(包括您的编辑器)可能具有您不知道的某些全局覆盖的任何不确定行为。
{
"lint": "eslint eslint.config.mjs src/**/*.{js,jsx,ts,tsx} --fix",
}
2/
仔细检查以确保您的 tsconfig.json
也包含 lint 范围内的所有文件。 tsconfig 范围必须比您的 lint 范围更宽。 例如:
{
"include": [
"./src/**/*.js",
"./src/**/*.jsx",
"./src/**/*.ts",
"./src/**/*.tsx",
"./eslint.config.mjs"
]
}