-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
72 lines (70 loc) · 2.31 KB
/
eslint.config.js
File metadata and controls
72 lines (70 loc) · 2.31 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
'use strict'
const eslintPluginImportX = require('eslint-plugin-import-x')
const eslintPluginJs = require('@eslint/js')
const eslintPluginN = require('eslint-plugin-n')
const eslintPluginStylistic = require('@stylistic/eslint-plugin')
const eslintPluginUnicorn = require('eslint-plugin-unicorn').default
const globals = require('globals')
module.exports = [
eslintPluginJs.configs.recommended,
eslintPluginImportX.flatConfigs.recommended,
eslintPluginN.configs['flat/recommended-script'],
eslintPluginStylistic.configs.recommended,
eslintPluginUnicorn.configs.recommended,
{
languageOptions: {
ecmaVersion: 2022,
sourceType: 'commonjs',
globals: {
...globals.es2022,
...globals.node,
},
},
settings: {
// Used by `eslint-plugin-n` to determine the minimum version of Node.js to support.
// Normally setting this in the `package.json` engines field is enough, but we can't use that as it will fail
// when running `yarn copy-artifacts` inside the prebuildify Docker container which uses Node.js 12.
node: { version: '>=18.0.0' },
},
rules: {
'@stylistic/brace-style': ['error', '1tbs'],
'@stylistic/space-before-function-paren': ['error', 'always'],
'import-x/extensions': ['error', 'never', { json: 'always' }],
'import-x/no-absolute-path': 'error',
'import-x/no-webpack-loader-syntax': 'error',
'import-x/order': ['error', {
'newlines-between': 'always',
}],
'n/no-process-exit': 'off', // Duplicate of unicorn/no-process-exit
'prefer-const': 'error',
'unicorn/prefer-module': 'off', // We use CJS
'unicorn/prevent-abbreviations': 'off',
},
},
{
files: ['load.js'],
languageOptions: {
globals: {
__webpack_require__: 'readonly',
__non_webpack_require__: 'readonly',
},
},
},
{
// This script runs inside the prebuildify Docker container which uses Node.js 12
files: ['scripts/copy-artifacts.js'],
languageOptions: {
ecmaVersion: 2019,
},
settings: {
// Used by `eslint-plugin-n` to determine the minimum version of Node.js to support.
node: { version: '>=12.0.0' },
},
rules: {
'unicorn/prefer-node-protocol': 'off',
},
},
{
ignores: ['build/', 'target/', 'prebuilds/'],
},
]