Skip to content

Commit 45364e4

Browse files
authored
chore(eslint): lint examples (#1033)
1 parent c2f912a commit 45364e4

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

eslint.config.mjs

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import eslint from '@eslint/js';
44
import tseslint from 'typescript-eslint';
55
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
6+
import globals from 'globals';
67

78
export default tseslint.config(
89
// replacement of legacy `.eslintignore`
@@ -13,8 +14,16 @@ export default tseslint.config(
1314
eslint.configs.recommended,
1415
...tseslint.configs.recommended,
1516
eslintPluginPrettierRecommended,
17+
// base config
1618
{
17-
files: ['*.js'],
19+
languageOptions: {
20+
globals: {
21+
...globals.node,
22+
},
23+
},
24+
},
25+
{
26+
files: ['**/*.js'],
1827
rules: {
1928
'@typescript-eslint/no-require-imports': 'off',
2029
'@typescript-eslint/no-var-requires': 'off',

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"install:all": "yarn && (cd examples && yarn)",
1414
"lint": "yarn prettier && yarn eslint",
1515
"lint:fix": "yarn prettier:fix && yarn eslint:fix",
16-
"eslint": "eslint '{src,test}/**/*.ts' --cache",
16+
"eslint": "eslint '{src,test,examples}/**/*.{js,ts}' --cache",
1717
"eslint:fix": "yarn eslint --fix",
1818
"prettier": "prettier --list-different \"**/*.{js,ts,md,yml,json,html}\"",
1919
"prettier:fix": "prettier --write \"**/*.{js,ts,md,yml,json,html}\"",
@@ -75,6 +75,7 @@
7575
"eslint-plugin-prettier": "5.2.1",
7676
"express": "4.19.2",
7777
"get-port": "5.1.1",
78+
"globals": "15.9.0",
7879
"husky": "9.1.5",
7980
"jest": "29.7.0",
8081
"lint-staged": "15.2.9",

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -2663,6 +2663,11 @@ global-directory@^4.0.1:
26632663
dependencies:
26642664
ini "4.1.1"
26652665

2666+
2667+
version "15.9.0"
2668+
resolved "https://registry.yarnpkg.com/globals/-/globals-15.9.0.tgz#e9de01771091ffbc37db5714dab484f9f69ff399"
2669+
integrity sha512-SmSKyLLKFbSr6rptvP8izbyxJL4ILwqO9Jg23UA0sDlGlu58V59D1//I3vlc0KJphVdUR7vMjHIplYnzBxorQA==
2670+
26662671
globals@^11.1.0:
26672672
version "11.12.0"
26682673
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"

0 commit comments

Comments
 (0)