-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
98 lines (95 loc) · 3.62 KB
/
eslint.config.js
File metadata and controls
98 lines (95 loc) · 3.62 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
// @ts-check
import eslint from '@eslint/js';
import globals from 'globals';
import jsonc from 'eslint-plugin-jsonc';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default [
{
ignores: [
'node_modules/',
'dist/',
'package-lock.json',
'.git/',
'AddonExeRP/font/',
'.github/',
'Dev/',
'Docs/',
'OldAntiCheatsBP/',
'OldAntiCheatsRP/',
'eslint.config.js',
'package.json',
],
},
// Base JS configuration
{
files: ['**/*.js'],
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
globals: {
...globals.browser,
...globals.node,
...globals.es2021,
// Minecraft Bedrock Scripting API globals
'system': 'readonly',
'world': 'readonly',
'mc': 'readonly',
'Minecraft': 'readonly',
'mojang-minecraft': 'readonly',
'mojang-gametest': 'readonly',
'mojang-minecraft-ui': 'readonly',
'mojang-server-admin': 'readonly',
'mojang-net': 'readonly',
},
},
linterOptions: {
reportUnusedDisableDirectives: 'error',
},
rules: {
...eslint.configs.recommended.rules,
'camelcase': ['error', { 'properties': 'always', 'ignoreDestructuring': true, 'allow': ['^UNSAFE_'] }],
'indent': ['error', 4, { 'SwitchCase': 1 }],
'quotes': ['error', 'single', { 'avoidEscape': true }],
'semi': ['error', 'always'],
'no-trailing-spaces': 'error',
'no-unused-vars': ['warn', { 'args': 'none' }],
'no-undef': 'error',
'object-curly-spacing': ['error', 'always'],
'comma-dangle': ['error', 'never'],
'no-console': 'warn',
'key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
'keyword-spacing': ['error', { 'before': true, 'after': true }],
'space-before-function-paren': ['error', {
'anonymous': 'always',
'named': 'never',
'asyncArrow': 'always',
}],
'arrow-spacing': ['error', { 'before': true, 'after': true }],
'curly': ['error', 'all'],
'eqeqeq': ['error', 'always'],
'no-var': 'error',
'comma-spacing': ['error', { 'before': false, 'after': true }],
'space-infix-ops': 'error',
'space-in-parens': ['error', 'never'],
'space-before-blocks': 'error',
'max-len': ['warn', { 'code': 256, 'ignoreUrls': true, 'ignoreStrings': true, 'ignoreTemplateLiterals': true, 'ignoreRegExpLiterals': true }],
},
},
// JSONC configuration
...jsonc.configs['flat/recommended-with-jsonc'],
{
files: ['**/*.json'],
rules: {
'jsonc/indent': ['error', 4],
'jsonc/object-curly-spacing': ['error', 'always'],
'jsonc/array-bracket-spacing': ['error', 'never'],
'jsonc/comma-dangle': ['error', 'never'],
'jsonc/key-spacing': ['error', { 'beforeColon': false, 'afterColon': true }],
'jsonc/object-curly-newline': ['error', { 'multiline': true, 'consistent': true }],
'jsonc/object-property-newline': ['error', { 'allowAllPropertiesOnSameLine': true }],
},
},
];