-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathorigin-eslint.config.js
99 lines (91 loc) · 2.19 KB
/
origin-eslint.config.js
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
'use strict';
// module.exports = {
// name: "name",
// files: ["*.js"],
// ignores: ["*.test.js"],
// settings: {},
// languageOptions: {
// ecmaVersion: 2020,
// sourceType: "module",
// globals: {},
// parser: object || "string",
// parserOptions: {},
// linterOptions: {
// reportUnusedDisableDirectives: "string"
// }
// }
// processor: object || "string",
// plugins: {}
// rules: {}
// };
const {
DEFAULT_FILES,
DEFAULT_IGNORE,
} = require('./packages/eslint/src/constants');
module.exports = [
/*
gets converted to
{
plugins: {
'eslint:recommended': require('somehow-load-eslint-internal-rules')
}
}
*/
// 'eslint:recommended',
{
name: 'loading-babel-eslint-parser-through-custom-plugin',
plugins: {
'custom-plugin': require('./custom-eslint-plugin'),
},
},
// consider linting src/index.jsx - both configs should apply for it
// so, what will the ConfigArray#getConfig(filename) return??
{
files: '**/*.{js,jsx}',
plugins: {
unicorn: require('eslint-plugin-unicorn'),
},
rules: {
'unicorn/no-process-exit': ['error'],
'unicorn/consistent-function-scoping': 'error',
semi: 'error',
},
},
{
files: '**/*.jsx',
plugins: {
react: require('eslint-plugin-react'),
},
rules: {
'react/jsx-uses-react': 'error',
'global-require': 'error',
},
},
{
name: 'some-tunnckocore-config',
files: DEFAULT_FILES,
ignores: DEFAULT_IGNORE,
languageOptions: {
globals: {},
// directly requiring the parser
// parser: require('babel-eslint'),
// or: through the loaded plugin
parser: 'custom-plugin/eslint-esnext',
// or require-ing of the plugin directly
// parser: require('./custom-eslint-plugin').parsers['eslint-esnext'],
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
generators: false,
objectLiteralDuplicateProperties: false,
},
},
},
plugins: {},
rules: {
semi: ['error', 'always'],
'global-require': ['error', 'always'],
},
},
];