Skip to content

Commit 641bd86

Browse files
authored
chore: enable ESLint on test folder (#2076)
1 parent b3275a1 commit 641bd86

25 files changed

+390
-265
lines changed

.eslintignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
.next
22
node_modules
3-
test
43
lib
54
demos
65
packages/runtime/src/templates/edge
76
packages/runtime/src/templates/edge-shared
87
packages/runtime/lib
98
packages/runtime/dist-types
10-
jestSetup.js
9+
jestSetup.js
10+
test/e2e
11+
test/fixtures/broken_next_config/next.config.js

.eslintrc.js

+23
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,28 @@ module.exports = {
5959
'promise/catch-or-return': 0,
6060
},
6161
},
62+
{
63+
files: ['test/**', 'packages/**/test/**'],
64+
plugins: ['jest'],
65+
extends: ['plugin:jest/recommended'],
66+
rules: {
67+
// Disable global rules
68+
'max-nested-callbacks': 'off',
69+
'@typescript-eslint/no-empty-function': 0,
70+
'max-lines-per-function': 0,
71+
'unicorn/no-empty-file': 0,
72+
'prefer-destructuring': 0,
73+
'@typescript-eslint/no-unused-vars': 0,
74+
'unicorn/no-await-expression-member': 0,
75+
'import/no-anonymous-default-export': 0,
76+
'no-shadow': 0,
77+
'@typescript-eslint/no-var-requires': 0,
78+
'require-await': 0,
79+
// esling-plugin-jest specific rules
80+
'jest/consistent-test-it': ['error', { fn: 'it', withinDescribe: 'it' }],
81+
'jest/no-disabled-tests': 0,
82+
'jest/no-conditional-expect': 0,
83+
},
84+
},
6285
],
6386
}

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ node_modules
2121
lib
2222
tsconfig.json
2323
demos/nx-next-monorepo-demo
24+
test/fixtures/broken_next_config/next.config.js
25+
test/e2e
2426

2527
**/CHANGELOG.md
2628
packages/runtime/lib

package-lock.json

+128-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"test:update": "run-s build build:demo test:jest:update"
3030
},
3131
"config": {
32-
"eslint": "--cache --format=codeframe --max-warnings=0 \"{packages,src,scripts,tests,.github}/**/*.{ts,js,md,html}\" \"*.{ts,js,md,html}\" \".*.{ts,js,md,html}\"",
33-
"prettier": "--loglevel=warn \"{packages,src,scripts,tests,.github}/**/*.{ts,js,md,yml,json,html}\" \"*.{ts,js,yml,json,html}\" \".*.{ts,js,yml,json,html}\" \"!package-lock.json\""
32+
"eslint": "--cache --format=codeframe --max-warnings=0 \"{packages,test,.github}/**/*.{ts,js,md,html}\" \"*.{ts,js,md,html}\" \".*.{ts,js,md,html}\"",
33+
"prettier": "--loglevel=warn \"{packages,test,.github}/**/*.{ts,js,md,yml,json,html}\" \"*.{ts,js,yml,json,html}\" \".*.{ts,js,yml,json,html}\" \"!package-lock.json\""
3434
},
3535
"repository": {
3636
"type": "git",
@@ -67,9 +67,11 @@
6767
"cypress": "^12.10.0",
6868
"escape-string-regexp": "^2.0.0",
6969
"eslint-config-next": "^12.0.0",
70+
"eslint-plugin-jest": "^27.2.1",
7071
"eslint-plugin-promise": "^6.0.0",
7172
"eslint-plugin-unicorn": "^43.0.2",
7273
"execa": "^5.1.1",
74+
"fs-extra": "^11.1.1",
7375
"husky": "^7.0.4",
7476
"jest": "^27.0.0",
7577
"jest-extended": "^3.2.0",
@@ -78,6 +80,8 @@
7880
"mock-fs": "^5.2.0",
7981
"netlify-plugin-cypress": "^2.2.1",
8082
"npm-run-all": "^4.1.5",
83+
"outdent": "^0.8.0",
84+
"pathe": "^1.1.0",
8185
"playwright-chromium": "1.28.1",
8286
"prettier": "^2.1.2",
8387
"react": "^18.2.0",

packages/next/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
],
99
"devDependencies": {
1010
"@netlify/edge-functions": "^2.0.0",
11+
"@types/chance": "^1.1.3",
1112
"@types/node": "^17.0.25",
13+
"chance": "^1.1.11",
1214
"next": "^13.3.0",
1315
"npm-run-all": "^4.1.5",
1416
"typescript": "^4.6.3"

0 commit comments

Comments
 (0)