@4players/odin-plugin-web 1.13.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,168 @@
1
+ import js from '@eslint/js';
2
+ import tseslint from 'typescript-eslint';
3
+
4
+ export default tseslint.config(
5
+ js.configs.recommended,
6
+ tseslint.configs.recommended,
7
+ {
8
+ ignores: [
9
+ 'lib/**',
10
+ 'build/**',
11
+ 'dist/**',
12
+ 'test/www/**',
13
+ 'src/common/version.ts',
14
+ ],
15
+ },
16
+ {
17
+ // Correctness / good-practice rules carried over from neostandard's base
18
+ // preset, with its exact options. neostandard itself is not a dependency:
19
+ // its only other contributions here were eslint-plugin-n (Node-CommonJS
20
+ // rules, irrelevant to a browser/WASM library) and a single naming rule
21
+ // from eslint-plugin-promise.
22
+ rules: {
23
+ 'accessor-pairs': [
24
+ 'error',
25
+ {
26
+ enforceForTSTypes: false,
27
+ enforceForClassMembers: true,
28
+ getWithoutSet: false,
29
+ setWithoutGet: true,
30
+ },
31
+ ],
32
+ 'array-callback-return': [
33
+ 'error',
34
+ {
35
+ allowImplicit: false,
36
+ checkForEach: false,
37
+ allowVoid: false,
38
+ },
39
+ ],
40
+ curly: ['error', 'multi-line'],
41
+ 'default-case-last': ['error'],
42
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
43
+ 'new-cap': [
44
+ 'error',
45
+ {
46
+ capIsNew: false,
47
+ capIsNewExceptions: [
48
+ 'Array',
49
+ 'Boolean',
50
+ 'Date',
51
+ 'Error',
52
+ 'Function',
53
+ 'Number',
54
+ 'Object',
55
+ 'RegExp',
56
+ 'String',
57
+ 'Symbol',
58
+ 'BigInt',
59
+ ],
60
+ newIsCap: true,
61
+ newIsCapExceptions: [],
62
+ properties: true,
63
+ },
64
+ ],
65
+ 'no-caller': ['error'],
66
+ 'no-eval': ['error', { allowIndirect: false }],
67
+ 'no-extend-native': ['error', { exceptions: [] }],
68
+ 'no-extra-bind': ['error'],
69
+ 'no-implied-eval': ['error'],
70
+ 'no-iterator': ['error'],
71
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
72
+ 'no-lone-blocks': ['error'],
73
+ 'no-multi-str': ['error'],
74
+ 'no-new': ['error'],
75
+ 'no-new-func': ['error'],
76
+ 'no-new-wrappers': ['error'],
77
+ 'no-object-constructor': ['error'],
78
+ 'no-octal-escape': ['error'],
79
+ 'no-proto': ['error'],
80
+ 'no-return-assign': ['error', 'except-parens'],
81
+ 'no-self-compare': ['error'],
82
+ 'no-sequences': ['error', { allowInParentheses: true }],
83
+ 'no-template-curly-in-string': ['error'],
84
+ 'no-throw-literal': ['error'],
85
+ 'no-undef-init': ['error'],
86
+ 'no-unmodified-loop-condition': ['error'],
87
+ 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
88
+ 'no-unreachable-loop': ['error', { ignore: [] }],
89
+ 'no-useless-call': ['error'],
90
+ 'no-useless-computed-key': ['error', { enforceForClassMembers: true }],
91
+ 'no-useless-rename': [
92
+ 'error',
93
+ {
94
+ ignoreDestructuring: false,
95
+ ignoreImport: false,
96
+ ignoreExport: false,
97
+ },
98
+ ],
99
+ 'no-useless-return': ['error'],
100
+ 'no-var': ['error'],
101
+ 'no-void': ['error', { allowAsStatement: false }],
102
+ 'object-shorthand': ['warn', 'properties'],
103
+ 'one-var': ['error', { initialized: 'never' }],
104
+ 'prefer-const': [
105
+ 'error',
106
+ { destructuring: 'all', ignoreReadBeforeAssign: false },
107
+ ],
108
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: false }],
109
+ 'prefer-regex-literals': ['error', { disallowRedundantWrapping: true }],
110
+ 'prefer-rest-params': ['error'],
111
+ 'prefer-spread': ['error'],
112
+ 'symbol-description': ['error'],
113
+ 'unicode-bom': ['error', 'never'],
114
+ yoda: ['error', 'never', { exceptRange: false, onlyEquality: false }],
115
+ },
116
+ },
117
+ {
118
+ // Type-aware promise safety. Only src/**/*.ts is covered by tsconfig's
119
+ // `include`, so the type graph is built for those files alone; everything
120
+ // else (esbuild.config.ts, test/, wasm/) keeps the syntactic rules above.
121
+ // Warn-level for now: these surface real findings that need per-call-site
122
+ // judgement (intentional fire-and-forget vs. a missing catch).
123
+ files: ['src/**/*.ts'],
124
+ languageOptions: {
125
+ parserOptions: {
126
+ projectService: true,
127
+ tsconfigRootDir: import.meta.dirname,
128
+ },
129
+ },
130
+ rules: {
131
+ '@typescript-eslint/no-floating-promises': 'warn',
132
+ '@typescript-eslint/no-misused-promises': 'warn',
133
+ '@typescript-eslint/await-thenable': 'warn',
134
+ '@typescript-eslint/no-for-in-array': 'warn',
135
+ },
136
+ },
137
+ {
138
+ // project choices; the core rules TS makes redundant (no-undef,
139
+ // no-unused-vars, ...) are already disabled by the presets above
140
+ rules: {
141
+ '@typescript-eslint/no-useless-constructor': 'off',
142
+ '@typescript-eslint/no-explicit-any': 'off',
143
+ '@typescript-eslint/ban-ts-comment': 'off',
144
+ '@typescript-eslint/no-empty-object-type': 'off',
145
+ camelcase: 'off',
146
+ // TypeScript already resolves identifiers; the sole plain-JS file is a
147
+ // 20-line dev server, so this rule has nothing left to catch here
148
+ 'no-undef': 'off',
149
+ // switch fallthrough is used deliberately in the codec/state machines
150
+ 'no-fallthrough': 'off',
151
+ // `const X = Symbol(); type X = typeof X` declaration merging (see src/common/sentinel.ts)
152
+ '@typescript-eslint/no-redeclare': 'off',
153
+ // message/command maps are grouped into namespaces (see src/common/messages.ts)
154
+ '@typescript-eslint/no-namespace': 'off',
155
+ // unused arguments and caught errors are signature-mandated here
156
+ '@typescript-eslint/no-unused-vars': [
157
+ 'error',
158
+ {
159
+ args: 'none',
160
+ caughtErrors: 'none',
161
+ ignoreRestSiblings: true,
162
+ vars: 'all',
163
+ destructuredArrayIgnorePattern: '^_',
164
+ },
165
+ ],
166
+ },
167
+ }
168
+ );