Skip to content

Commit decb63c

Browse files
Merge branch 'canary' into perf/shared-static-worker-pool
2 parents 2285b8f + 6014b6e commit decb63c

File tree

24 files changed

+124
-37
lines changed

24 files changed

+124
-37
lines changed

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
"registry": "https://registry.npmjs.org/"
1818
}
1919
},
20-
"version": "11.0.2-canary.28"
20+
"version": "11.0.2-canary.29"
2121
}

packages/create-next-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-next-app",
3-
"version": "11.0.2-canary.28",
3+
"version": "11.0.2-canary.29",
44
"keywords": [
55
"react",
66
"next",

packages/eslint-config-next/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eslint-config-next",
3-
"version": "11.0.2-canary.28",
3+
"version": "11.0.2-canary.29",
44
"description": "ESLint configuration used by NextJS.",
55
"main": "index.js",
66
"license": "MIT",
@@ -9,7 +9,7 @@
99
"directory": "packages/eslint-config-next"
1010
},
1111
"dependencies": {
12-
"@next/eslint-plugin-next": "11.0.2-canary.28",
12+
"@next/eslint-plugin-next": "11.0.2-canary.29",
1313
"@rushstack/eslint-patch": "^1.0.6",
1414
"@typescript-eslint/parser": "^4.20.0",
1515
"eslint-import-resolver-node": "^0.3.4",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# `@next/eslint-plugin-next`
2+
3+
Documentation for `@next/eslint-plugin-next` can be found at:
4+
https://nextjs.org/docs/basic-features/eslint#eslint-plugin
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es2019"
5+
},
6+
"exclude": ["node_modules"]
7+
}

packages/eslint-plugin-next/lib/rules/google-font-display.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const NodeAttributes = require('../utils/nodeAttributes.js')
1+
const NodeAttributes = require('../utils/node-attributes.js')
22

33
module.exports = {
44
meta: {

packages/eslint-plugin-next/lib/rules/google-font-preconnect.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const NodeAttributes = require('../utils/nodeAttributes.js')
1+
const NodeAttributes = require('../utils/node-attributes.js')
22

33
module.exports = {
44
meta: {

packages/eslint-plugin-next/lib/rules/link-passhref.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const NodeAttributes = require('../utils/nodeAttributes.js')
1+
const NodeAttributes = require('../utils/node-attributes.js')
22

33
module.exports = {
44
meta: {

packages/eslint-plugin-next/lib/rules/no-html-link-for-pages.js

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// @ts-check
12
const path = require('path')
23
const fs = require('fs')
4+
const getRootDir = require('../utils/get-root-dirs')
35
const {
46
getUrlFromPagesDirectories,
57
normalizeURL,
@@ -20,7 +22,7 @@ const fsExistsSyncCache = {}
2022
module.exports = {
2123
meta: {
2224
docs: {
23-
description: 'Prohibit full page refresh for nextjs pages',
25+
description: 'Prohibit full page refresh for Next.js pages',
2426
category: 'HTML',
2527
recommended: true,
2628
},
@@ -43,14 +45,27 @@ module.exports = {
4345
],
4446
},
4547

48+
/**
49+
* Creates an ESLint rule listener.
50+
*
51+
* @param {import('eslint').Rule.RuleContext} context - ESLint rule context
52+
* @returns {import('eslint').Rule.RuleListener} An ESLint rule listener
53+
*/
4654
create: function (context) {
47-
const [customPagesDirectory] = context.options
48-
const pagesDirs = customPagesDirectory
49-
? [customPagesDirectory].flat()
50-
: [
51-
path.join(context.getCwd(), 'pages'),
52-
path.join(context.getCwd(), 'src', 'pages'),
53-
]
55+
/** @type {(string|string[])[]} */
56+
const ruleOptions = context.options
57+
const [customPagesDirectory] = ruleOptions
58+
59+
const rootDirs = getRootDir(context)
60+
61+
const pagesDirs = (customPagesDirectory
62+
? [customPagesDirectory]
63+
: rootDirs.map((dir) => [
64+
path.join(dir, 'pages'),
65+
path.join(dir, 'src', 'pages'),
66+
])
67+
).flat()
68+
5469
const foundPagesDirs = pagesDirs.filter((dir) => {
5570
if (fsExistsSyncCache[dir] === undefined) {
5671
fsExistsSyncCache[dir] = fs.existsSync(dir)

packages/eslint-plugin-next/lib/rules/no-page-custom-font.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const NodeAttributes = require('../utils/nodeAttributes.js')
1+
const NodeAttributes = require('../utils/node-attributes.js')
22

33
module.exports = {
44
meta: {

0 commit comments

Comments
 (0)