Skip to content

Commit c58b3bd

Browse files
mrtnzlmladeira-github-bot
authored andcommitted
Eslint config: re-enable @next/next/no-html-link-for-pages rule
Closes: adeira/universe#3024 adeira-source-id: 4252a6329a11cf25030834dad4d19d6307a567a1
1 parent b50cb7b commit c58b3bd

File tree

4 files changed

+34
-11
lines changed

4 files changed

+34
-11
lines changed

CHANGELOG.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
# Unreleased
22

33
- New rules `@next/next/inline-script-id`, `@next/next/no-script-in-document` and `@next/next/no-script-in-head` enabled (as warnings). For more information visit: https://nextjs.org/docs/basic-features/eslint#eslint-plugin
4-
- Rule `@next/next/no-html-link-for-pages` has been temporarily disabled because of [internal issues](https://github.com/adeira/universe/issues/3024).
4+
- We clarified what to do when you are using `@adeira/eslint-config/next` preset inside monorepo (check our readme). Basically, you might encounter the following warning:
5+
6+
```text
7+
Pages directory cannot be found at /X/Y/Z/pages or /X/Y/Z/src/pages. If using a custom path, please configure with the no-html-link-for-pages rule in your eslint config file
8+
```
9+
10+
In this case it's necessary to configure the Next.js eslint preset explicitly, for example:
11+
12+
```js
13+
module.exports = {
14+
extends: ['@adeira/eslint-config', '@adeira/eslint-config/next'],
15+
settings: {
16+
next: { rootDir: __dirname },
17+
},
18+
};
19+
```
20+
21+
For more info visit: https://nextjs.org/docs/messages/no-html-link-for-pages
522

623
# 6.4.0
724

@@ -13,14 +30,14 @@
1330

1431
- Added new optional config preset `@adeira/eslint-config/next` (for [Next.js](https://nextjs.org/) applications). This preset is not included in the default config and should be enabled explicitly for Next.js applications. For example:
1532

16-
```js
17-
module.exports = {
18-
extends: [
19-
'@adeira/eslint-config', // this preset includes almost everything but not Next.js rules
20-
'@adeira/eslint-config/next', // adds extra Next.js rules for your application
21-
],
22-
};
23-
```
33+
```js
34+
module.exports = {
35+
extends: [
36+
'@adeira/eslint-config', // this preset includes almost everything but not Next.js rules
37+
'@adeira/eslint-config/next', // adds extra Next.js rules for your application
38+
],
39+
};
40+
```
2441

2542
# 6.2.0
2643

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ module.exports = {
9595
'@adeira/eslint-config',
9696
'@adeira/eslint-config/next', // optional Next.js rules not included by default
9797
],
98+
99+
// The following settings might be needed in case you are trying to apply Next.js preset inside
100+
// monorepo subdirectory, see: https://nextjs.org/docs/basic-features/eslint#rootdir
101+
settings: {
102+
next: { rootDir: __dirname },
103+
},
98104
};
99105
```
100106

__tests__/__snapshots__/presets.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ Object {
750750
"@next/next/no-document-import-in-page": 1,
751751
"@next/next/no-duplicate-head": 1,
752752
"@next/next/no-head-import-in-document": 1,
753-
"@next/next/no-html-link-for-pages": 0,
753+
"@next/next/no-html-link-for-pages": 1,
754754
"@next/next/no-img-element": 1,
755755
"@next/next/no-page-custom-font": 1,
756756
"@next/next/no-script-in-document": 1,

src/presets/next.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = ({
2121
'@next/next/no-document-import-in-page': NEXT_VERSION_ERROR,
2222
'@next/next/no-duplicate-head': NEXT_VERSION_ERROR,
2323
'@next/next/no-head-import-in-document': NEXT_VERSION_ERROR,
24-
'@next/next/no-html-link-for-pages': OFF, // TODO: https://github.com/adeira/universe/issues/3024
24+
'@next/next/no-html-link-for-pages': NEXT_VERSION_ERROR,
2525
'@next/next/no-img-element': NEXT_VERSION_ERROR,
2626
'@next/next/no-page-custom-font': NEXT_VERSION_ERROR,
2727
'@next/next/no-script-in-document': NEXT_VERSION_ERROR,

0 commit comments

Comments
 (0)