Repository navigation
Expand file tree
/
Copy patheslint.config.cjs
More file actions
65 lines (58 loc) · 1.58 KB
/
Copy patheslint.config.cjs
File metadata and controls
65 lines (58 loc) · 1.58 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
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
const { FlatCompat } = require('@eslint/eslintrc');
const { fixupConfigRules } = require('@eslint/compat');
const { globalIgnores } = require('eslint/config');
const eslint = require('eslint');
const { builtinRules } = require('eslint/use-at-your-own-risk');
const rootConfig = require('./.eslintrc.js');
const docsConfig = require('./src-docs/.eslintrc.js');
// eslint-plugin-babel reads built-in rules through Linter#getRules(), which
// was removed in ESLint 10. Keep the legacy plugin working while the shared
// Kibana config still depends on it.
if (!eslint.Linter.prototype.getRules) {
eslint.Linter.prototype.getRules = () => builtinRules;
}
const compat = new FlatCompat({
baseDirectory: __dirname,
resolvePluginsRelativeTo: __dirname,
});
const ignores = [
'dist',
'node_modules',
'es',
'lib',
'test-env',
'types',
'oui.d.ts',
'**/.babelrc.js',
'**/*.snap.js',
'**/assets/**/*.js',
'package.json',
'src-docs/src/views/icon/icon_example.js',
'packages/react-datepicker/examples',
];
const docsRules = {
...docsConfig.rules,
};
module.exports = [
globalIgnores(ignores),
{
linterOptions: {
reportUnusedDisableDirectives: false,
},
},
...fixupConfigRules(compat.config(rootConfig)),
{
files: ['src-docs/**/*.{ts,tsx,js}'],
rules: docsRules,
},
];