-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
96 lines (94 loc) · 2.98 KB
/
Copy patheslint.config.js
File metadata and controls
96 lines (94 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import { defineConfig } from "eslint/config";
import globals from "globals";
import js from "@eslint/js";
import jest from "eslint-plugin-jest";
import json from "@eslint/json";
import jsonc from "eslint-plugin-jsonc";
import markdown from "@eslint/markdown";
import eslintConfigPrettier from "eslint-config-prettier/flat";
export default defineConfig([
{
ignores: ["**/node_modules/**", ".yarn/**", ".cache/**", "scripts/template/**", "dist/**", "coverage/**"],
},
{
files: ["**/*.js"],
plugins: { js },
extends: ["js/recommended"],
languageOptions: {
sourceType: "module",
globals: globals.node,
},
rules: {
eqeqeq: ["error", "smart"],
"no-var": "error",
"prefer-const": "error",
"no-unused-vars": ["error", { argsIgnorePattern: "^_", varsIgnorePattern: "^_", caughtErrors: "none" }],
// Logs should be written through @actions/core & fails via
// core.setFailed — never the raw console or a hard process exit.
"no-console": "error",
"no-process-exit": "error",
// Don't let unfinished markers ride along into a published action.
"no-warning-comments": ["warn", { terms: ["todo", "fixme", "xxx"], location: "anywhere" }],
},
},
// Specific to tooling and repository-management scripts.
{
files: ["scripts/**/*.js"],
rules: {
"no-console": "off",
"no-process-exit": "off",
"no-warning-comments": "off",
},
},
{
files: ["**/*.test.js"],
plugins: { jest },
extends: ["jest/recommended"],
languageOptions: {
globals: jest.environments.globals.globals,
},
},
{
// All JSON except package.json, which has its own jsonc block below.
files: ["**/*.json"],
ignores: ["**/package.json"],
plugins: { json },
language: "json/json",
extends: ["json/recommended"],
rules: {
"json/sort-keys": [
"warn",
"asc",
{
natural: true,
}
],
},
},
{
files: ["package.json"],
plugins: { jsonc },
language: "jsonc/jsonc",
extends: ["jsonc/recommended-with-json"],
rules: {
"jsonc/sort-keys": [
"warn",
{
pathPattern: "^$",
order: ["$schema", "private", "publishConfig", "name", "version", "description", "license", "author", "maintainers", "contributors", "homepage", "funding", "repository", "bugs", "type", "exports", "main", "module", "browser", "man", "preferGlobal", "bin", "files", "directories", "scripts", "config", "sideEffects", "types", "typings", "workspaces", "resolutions", "dependencies", "bundleDependencies", "bundledDependencies", "peerDependencies", "peerDependenciesMeta", "optionalDependencies", "devDependencies", "keywords", "engines", "engineStrict", "os", "cpu", "*", "packageManager"],
},
{ pathPattern: "^repository$", order: ["type", "url", "directory"] },
{ pathPattern: "^vague$", order: { type: "asc" } },
{ pathPattern: "^exports$", order: ["."] },
{ pathPattern: ".*", order: { type: "asc" } },
],
},
},
{
files: ["**/*.md"],
plugins: { markdown },
language: "markdown/gfm",
extends: ["markdown/recommended"],
},
eslintConfigPrettier,
]);