-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy patheslint.config.js
More file actions
117 lines (111 loc) · 2.97 KB
/
eslint.config.js
File metadata and controls
117 lines (111 loc) · 2.97 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**
* @fileoverview ESLint configuration file.
* @author Nicholas C. Zakas
*/
//-----------------------------------------------------------------------------
// Imports
//-----------------------------------------------------------------------------
import eslintConfigESLint from "eslint-config-eslint";
import eslintPlugin from "eslint-plugin-eslint-plugin";
import globals from "globals";
import json from "@eslint/json";
import { defineConfig, globalIgnores } from "eslint/config";
import css from "./src/index.js";
//-----------------------------------------------------------------------------
// Helpers
//-----------------------------------------------------------------------------
const eslintPluginRulesRecommendedConfig =
eslintPlugin.configs["rules-recommended"];
const eslintPluginTestsRecommendedConfig =
eslintPlugin.configs["tests-recommended"];
//-----------------------------------------------------------------------------
// Configuration
//-----------------------------------------------------------------------------
export default defineConfig([
globalIgnores(["coverage/", "dist/", "src/build/"], "css/global-ignores"),
{
name: "css/js",
files: ["**/*.js"],
extends: [eslintConfigESLint],
rules: {
"no-undefined": "off",
"class-methods-use-this": "off",
},
},
{
name: "css/tools",
files: ["tools/**/*.js"],
rules: {
"no-console": "off",
},
},
{
name: "css/tests",
files: ["tests/**/*.js"],
ignores: ["tests/rules/*.js"],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
{
name: "css/rules",
files: ["src/rules/*.js"],
extends: [eslintPluginRulesRecommendedConfig],
rules: {
"eslint-plugin/require-meta-schema": "off", // `schema` defaults to []
"eslint-plugin/require-meta-schema-description": "off",
"eslint-plugin/prefer-placeholders": "error",
"eslint-plugin/prefer-replace-text": "error",
"eslint-plugin/report-message-format": ["error", "^[^a-z].*\\.$"],
"eslint-plugin/require-meta-docs-description": [
"error",
{ pattern: "^(Enforce|Require|Disallow) .+[^. ]$" },
],
"eslint-plugin/require-meta-docs-url": [
"error",
{
pattern:
"https://github.com/eslint/css/blob/main/docs/rules/{{name}}.md",
},
],
},
},
{
name: "css/rules-tests",
files: ["tests/rules/*.test.js"],
extends: [eslintPluginTestsRecommendedConfig],
rules: {
"eslint-plugin/test-case-property-ordering": [
"error",
[
"name",
"filename",
"code",
"output",
"language",
"options",
"languageOptions",
"errors",
],
],
"eslint-plugin/test-case-shorthand-strings": "error",
},
},
{
name: "css/json",
plugins: { json },
files: ["**/*.json", ".c8rc"],
language: "json/json",
extends: ["json/recommended"],
},
// This CSS configuration is mainly used to validate the `test.css` file for local testing.
{
name: "css/css",
plugins: { css },
files: ["**/*.css"],
language: "css/css",
extends: ["css/recommended"],
},
]);