Skip to content

Commit b265227

Browse files
committed
chore: update eslint config to add JSON linting
1 parent fe4baa8 commit b265227

File tree

3 files changed

+56
-95
lines changed

3 files changed

+56
-95
lines changed

eslint.config.mjs

Lines changed: 28 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,35 @@
33
* Licensed under the MIT License. See License.md in the project root for license information.
44
* -------------------------------------------------------------------------------------------- */
55

6-
import eslint from "@eslint/js";
7-
import { defineConfig, globalIgnores } from "eslint/config";
8-
import tseslint from "typescript-eslint";
9-
import _import from "eslint-plugin-import";
10-
import prettier from "eslint-plugin-prettier/recommended";
11-
import globals from "globals";
6+
import { defineConfig, globalIgnores } from 'eslint/config';
7+
import _import from 'eslint-plugin-import';
8+
import globals from 'globals';
9+
import js from '@eslint/js';
10+
import json from '@eslint/json';
11+
import prettier from 'eslint-plugin-prettier/recommended';
12+
import tseslint from 'typescript-eslint';
1213

1314

1415
export default defineConfig([
16+
17+
js.configs.recommended,
18+
_import.flatConfigs.recommended,
19+
_import.flatConfigs.typescript,
20+
1521
globalIgnores([
1622
'eslint.config.mjs',
1723
'out/*',
1824
'dist/*',
1925
]),
2026

21-
eslint.configs.recommended,
2227
tseslint.configs.recommendedTypeChecked,
23-
_import.flatConfigs.recommended,
24-
_import.flatConfigs.typescript,
25-
2628
{
29+
files: [
30+
'src/**/*.ts',
31+
'scripts/*.ts',
32+
'test/*.ts',
33+
],
34+
2735
languageOptions: {
2836
sourceType: 'module',
2937
parser: tseslint.parser,
@@ -40,13 +48,6 @@ export default defineConfig([
4048
...globals.mocha,
4149
}
4250
},
43-
},
44-
{
45-
files: [
46-
'src/**/*.ts',
47-
'scripts/*.ts',
48-
'test/*.ts',
49-
],
5051

5152
rules: {
5253
'@typescript-eslint/naming-convention': [
@@ -86,6 +87,7 @@ export default defineConfig([
8687
'yoda': 'error',
8788
},
8889
},
90+
8991
{
9092
// Turn off rules that will cause errors with chai
9193
files: [
@@ -96,85 +98,16 @@ export default defineConfig([
9698
'no-unused-expressions': 'off',
9799
'@typescript-eslint/no-unused-expressions': 'off',
98100
}
101+
},
99102

100-
101-
/* rules: {
102-
"@typescript-eslint/explicit-module-boundary-types": "off",
103-
"@typescript-eslint/indent": "off",
104-
105-
"@typescript-eslint/no-empty-function": ["warn", {
106-
allow: ["constructors"],
107-
}],
108-
109-
"@typescript-eslint/no-empty-interface": "error",
110-
"@typescript-eslint/no-explicit-any": "off",
111-
112-
"@typescript-eslint/no-inferrable-types": ["warn", {
113-
ignoreParameters: true,
114-
ignoreProperties: true,
115-
}],
116-
117-
"@typescript-eslint/no-namespace": "off",
118-
"@typescript-eslint/no-non-null-assertion": "off",
119-
120-
"@typescript-eslint/no-unused-vars": ["warn", {
121-
args: "after-used",
122-
argsIgnorePattern: "^_",
123-
ignoreRestSiblings: true,
124-
varsIgnorePattern: "^_$",
125-
}],
126-
127-
"@typescript-eslint/no-use-before-define": "error",
128-
"@typescript-eslint/semi": "error",
129-
"@typescript-eslint/unbound-method": "off",
130-
"arrow-parens": ["error", "as-needed"],
131-
132-
"brace-style": ["warn", "1tbs", {
133-
allowSingleLine: true,
134-
}],
135-
136-
"comma-dangle": ["error", "only-multiline"],
137-
complexity: "off",
138-
"dot-notation": "error",
139-
eqeqeq: ["error", "smart"],
140-
"eol-last": "error",
141-
"import/no-dynamic-require": "error",
142-
"import/no-default-export": "error",
143-
"import/no-duplicates": "error",
144-
"import/no-self-import": "error",
145-
146-
"import/no-unresolved": ["warn", {
147-
ignore: ["vscode"],
148-
}],
149-
150-
"max-classes-per-file": ["error", 1],
151-
152-
"no-bitwise": "error",
153-
"no-console": "off",
154-
155-
"no-inner-declarations": "off",
156-
"no-invalid-this": "error",
157-
"no-trailing-spaces": "error",
158-
"no-var": "error",
159-
"prefer-arrow-callback": "error",
160-
"prefer-const": "error",
161-
"prefer-numeric-literals": "error",
162-
"prefer-object-spread": "error",
163-
"prefer-rest-params": "error",
164-
"prefer-spread": "error",
165-
"prefer-template": "error",
166-
"prettier/prettier": "error",
167-
semi: ["error", "always"],
168-
"semi-style": ["error", "last"],
169-
"spaced-comment": ["error", "always"],
170-
"space-in-parens": ["error", "never"],
171-
172-
'sort-imports': ['error', {
173-
ignoreCase: true,
174-
ignoreMemberSort: false,
175-
}],
176-
177-
} */
103+
// Lint JSON
104+
{
105+
files: ['/**/*.json'],
106+
ignores: ['package-lock.json'],
107+
plugins: { json },
108+
language: 'json/json',
109+
...json.configs.recommended,
110+
extends: [ tseslint.configs.disableTypeChecked],
178111
},
179112

180113
prettier,

package-lock.json

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"devDependencies": {
5757
"@appliedengdesign/cnccodes-json-schema": "^0.3.0",
5858
"@eslint/js": "^9.35.0",
59+
"@eslint/json": "^0.13.2",
5960
"@types/chai": "^5.2.2",
6061
"@types/mocha": "^10.0.10",
6162
"@types/node": "^22.18.1",

0 commit comments

Comments
 (0)