-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy patheslint.config.js
More file actions
138 lines (135 loc) · 3.54 KB
/
eslint.config.js
File metadata and controls
138 lines (135 loc) · 3.54 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// @ts-nocheck
import babelParser from '@babel/eslint-parser';
import { includeIgnoreFile } from '@eslint/compat';
import html from '@html-eslint/eslint-plugin';
import globals from 'globals';
import path from 'node:path';
import i18nPlugin from './eslint/i18n/eslint-plugin-i18n.js';
import litA11yCleverCloud from './eslint/lit-a11y/eslint-config-lit-a11y-clever-cloud.js';
import litCleverCloud from './eslint/lit/eslint-config-lit-cc.js';
import wcCleverCloud from './eslint/wc/eslint-config-wc-clever-cloud.js';
import { cleverCloud } from '@clevercloud/eslint-config';
const gitignorePath = path.resolve('./', '.gitignore');
export default [
// common ignores
includeIgnoreFile(gitignorePath),
{
name: 'cc-browser-config',
files: ['**/*.js', '**/*.mjs'],
ignores: ['docs/**/*', '**/*.d.ts', 'src/assets/**/*'],
linterOptions: {
reportUnusedDisableDirectives: 'warn',
},
languageOptions: {
globals: globals.browser,
ecmaVersion: 2022,
sourceType: 'module',
parserOptions: {
ecmaFeatures: {
impliedStrict: true,
},
},
},
...cleverCloud.configs.browser,
},
i18nPlugin.configs.recommended,
wcCleverCloud,
litCleverCloud,
litA11yCleverCloud,
{
name: 'html-baseline',
plugins: {
'@html-eslint': html,
},
rules: { '@html-eslint/use-baseline': 'error' },
files: ['src/components/*/*.js'],
},
{
name: 'mocha-context',
files: ['**/*.test.*js', 'test/**/*.js', 'test-mocha/**/*.js'],
languageOptions: {
globals: {
...globals.mocha,
},
},
},
{
name: 'node-esm-context',
files: [
'tasks/**/*.js',
'rollup/**/*.js',
'cem/**/*.js',
'web-test-runner.config.js',
'web-test-runner.config*.js',
'web-test-runner/**/*.js',
'src/stories/lib/smart-auth-plugin.js',
'test-mocha/**/*.*js',
'.storybook/**/*.js',
'.github/**/*.js',
],
languageOptions: {
globals: {
...globals.node,
},
},
...cleverCloud.configs.node,
},
// Allow importing dev dependencies for files that are related to build / stories / tooling / testing
{
name: 'allow-extraneous-imports',
files: [
'**/*.test.js',
'test/**/*.*js',
'test-mocha/**/*.*js',
'src/stories/**/*.js',
'eslint.config.js',
'eslint/**/*.*js',
'prettier.config.js',
'tasks/**/*.js',
'rollup/**/*.js',
'cem/**/*.js',
'web-test-runner.config.js',
'web-test-runner.visual-tests.config.js',
'web-test-runner/**/*.js',
'.storybook/**/*.js',
'.github/**/*.js',
],
rules: {
'import-x/no-extraneous-dependencies': [
'error',
{ devDependencies: true, optionalDependencies: false, peerDependencies: false },
],
},
},
{
name: 'allow-unresolved-import',
files: ['**/*.js'],
ignores: ['docs/**/*.js'],
// FIXME: We have to do this due to a ESLint bug
plugins: { 'import-x': cleverCloud.configs.browser.plugins['import-x'] },
rules: {
'import-x/no-unresolved': [
'error',
{
ignore: ['custom-elements.json'],
},
],
},
},
{
name: 'import-attributes',
files: ['tasks/visual-tests/*.js'],
languageOptions: {
sourceType: 'module',
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {
configFile: false,
babelrc: false,
plugins: ['@babel/plugin-syntax-import-attributes'],
},
},
},
},
];