eslint-plugin-nextjs 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/dist/index.d.ts +4 -39
- package/dist/index.js +403 -274
- package/dist/index.js.map +1 -1
- package/package.json +15 -10
- package/dist/index.cjs +0 -1494
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -43
- package/dist/rules/google-font-display.cjs +0 -119
- package/dist/rules/google-font-display.cjs.map +0 -1
- package/dist/rules/google-font-display.d.cts +0 -8
- package/dist/rules/google-font-display.d.ts +0 -8
- package/dist/rules/google-font-display.js +0 -92
- package/dist/rules/google-font-display.js.map +0 -1
- package/dist/rules/google-font-preconnect.cjs +0 -109
- package/dist/rules/google-font-preconnect.cjs.map +0 -1
- package/dist/rules/google-font-preconnect.d.cts +0 -5
- package/dist/rules/google-font-preconnect.d.ts +0 -5
- package/dist/rules/google-font-preconnect.js +0 -82
- package/dist/rules/google-font-preconnect.js.map +0 -1
- package/dist/rules/inline-script-id.cjs +0 -94
- package/dist/rules/inline-script-id.cjs.map +0 -1
- package/dist/rules/inline-script-id.d.cts +0 -5
- package/dist/rules/inline-script-id.d.ts +0 -5
- package/dist/rules/inline-script-id.js +0 -67
- package/dist/rules/inline-script-id.js.map +0 -1
- package/dist/rules/next-script-for-ga.cjs +0 -129
- package/dist/rules/next-script-for-ga.cjs.map +0 -1
- package/dist/rules/next-script-for-ga.d.cts +0 -5
- package/dist/rules/next-script-for-ga.d.ts +0 -5
- package/dist/rules/next-script-for-ga.js +0 -102
- package/dist/rules/next-script-for-ga.js.map +0 -1
- package/dist/rules/no-assign-module-variable.cjs +0 -64
- package/dist/rules/no-assign-module-variable.cjs.map +0 -1
- package/dist/rules/no-assign-module-variable.d.cts +0 -5
- package/dist/rules/no-assign-module-variable.d.ts +0 -5
- package/dist/rules/no-assign-module-variable.js +0 -37
- package/dist/rules/no-assign-module-variable.js.map +0 -1
- package/dist/rules/no-async-client-component.cjs +0 -99
- package/dist/rules/no-async-client-component.cjs.map +0 -1
- package/dist/rules/no-async-client-component.d.cts +0 -5
- package/dist/rules/no-async-client-component.d.ts +0 -5
- package/dist/rules/no-async-client-component.js +0 -72
- package/dist/rules/no-async-client-component.js.map +0 -1
- package/dist/rules/no-before-interactive-script-outside-document.cjs +0 -94
- package/dist/rules/no-before-interactive-script-outside-document.cjs.map +0 -1
- package/dist/rules/no-before-interactive-script-outside-document.d.cts +0 -5
- package/dist/rules/no-before-interactive-script-outside-document.d.ts +0 -5
- package/dist/rules/no-before-interactive-script-outside-document.js +0 -59
- package/dist/rules/no-before-interactive-script-outside-document.js.map +0 -1
- package/dist/rules/no-css-tags.cjs +0 -70
- package/dist/rules/no-css-tags.cjs.map +0 -1
- package/dist/rules/no-css-tags.d.cts +0 -5
- package/dist/rules/no-css-tags.d.ts +0 -5
- package/dist/rules/no-css-tags.js +0 -43
- package/dist/rules/no-css-tags.js.map +0 -1
- package/dist/rules/no-document-import-in-page.cjs +0 -74
- package/dist/rules/no-document-import-in-page.cjs.map +0 -1
- package/dist/rules/no-document-import-in-page.d.cts +0 -5
- package/dist/rules/no-document-import-in-page.d.ts +0 -5
- package/dist/rules/no-document-import-in-page.js +0 -39
- package/dist/rules/no-document-import-in-page.js.map +0 -1
- package/dist/rules/no-duplicate-head.cjs +0 -87
- package/dist/rules/no-duplicate-head.cjs.map +0 -1
- package/dist/rules/no-duplicate-head.d.cts +0 -5
- package/dist/rules/no-duplicate-head.d.ts +0 -5
- package/dist/rules/no-duplicate-head.js +0 -60
- package/dist/rules/no-duplicate-head.js.map +0 -1
- package/dist/rules/no-head-element.cjs +0 -76
- package/dist/rules/no-head-element.cjs.map +0 -1
- package/dist/rules/no-head-element.d.cts +0 -5
- package/dist/rules/no-head-element.d.ts +0 -5
- package/dist/rules/no-head-element.js +0 -41
- package/dist/rules/no-head-element.js.map +0 -1
- package/dist/rules/no-head-import-in-document.cjs +0 -76
- package/dist/rules/no-head-import-in-document.cjs.map +0 -1
- package/dist/rules/no-head-import-in-document.d.cts +0 -5
- package/dist/rules/no-head-import-in-document.d.ts +0 -5
- package/dist/rules/no-head-import-in-document.js +0 -41
- package/dist/rules/no-head-import-in-document.js.map +0 -1
- package/dist/rules/no-html-link-for-pages.cjs +0 -302
- package/dist/rules/no-html-link-for-pages.cjs.map +0 -1
- package/dist/rules/no-html-link-for-pages.d.cts +0 -5
- package/dist/rules/no-html-link-for-pages.d.ts +0 -5
- package/dist/rules/no-html-link-for-pages.js +0 -267
- package/dist/rules/no-html-link-for-pages.js.map +0 -1
- package/dist/rules/no-img-element.cjs +0 -83
- package/dist/rules/no-img-element.cjs.map +0 -1
- package/dist/rules/no-img-element.d.cts +0 -5
- package/dist/rules/no-img-element.d.ts +0 -5
- package/dist/rules/no-img-element.js +0 -48
- package/dist/rules/no-img-element.js.map +0 -1
- package/dist/rules/no-page-custom-font.cjs +0 -184
- package/dist/rules/no-page-custom-font.cjs.map +0 -1
- package/dist/rules/no-page-custom-font.d.cts +0 -5
- package/dist/rules/no-page-custom-font.d.ts +0 -5
- package/dist/rules/no-page-custom-font.js +0 -159
- package/dist/rules/no-page-custom-font.js.map +0 -1
- package/dist/rules/no-script-component-in-head.cjs +0 -74
- package/dist/rules/no-script-component-in-head.cjs.map +0 -1
- package/dist/rules/no-script-component-in-head.d.cts +0 -5
- package/dist/rules/no-script-component-in-head.d.ts +0 -5
- package/dist/rules/no-script-component-in-head.js +0 -47
- package/dist/rules/no-script-component-in-head.js.map +0 -1
- package/dist/rules/no-styled-jsx-in-document.cjs +0 -78
- package/dist/rules/no-styled-jsx-in-document.cjs.map +0 -1
- package/dist/rules/no-styled-jsx-in-document.d.cts +0 -5
- package/dist/rules/no-styled-jsx-in-document.d.ts +0 -5
- package/dist/rules/no-styled-jsx-in-document.js +0 -43
- package/dist/rules/no-styled-jsx-in-document.js.map +0 -1
- package/dist/rules/no-sync-scripts.cjs +0 -64
- package/dist/rules/no-sync-scripts.cjs.map +0 -1
- package/dist/rules/no-sync-scripts.d.cts +0 -5
- package/dist/rules/no-sync-scripts.d.ts +0 -5
- package/dist/rules/no-sync-scripts.js +0 -37
- package/dist/rules/no-sync-scripts.js.map +0 -1
- package/dist/rules/no-title-in-document-head.cjs +0 -78
- package/dist/rules/no-title-in-document-head.cjs.map +0 -1
- package/dist/rules/no-title-in-document-head.d.cts +0 -5
- package/dist/rules/no-title-in-document-head.d.ts +0 -5
- package/dist/rules/no-title-in-document-head.js +0 -51
- package/dist/rules/no-title-in-document-head.js.map +0 -1
- package/dist/rules/no-typos.cjs +0 -133
- package/dist/rules/no-typos.cjs.map +0 -1
- package/dist/rules/no-typos.d.cts +0 -5
- package/dist/rules/no-typos.d.ts +0 -5
- package/dist/rules/no-typos.js +0 -98
- package/dist/rules/no-typos.js.map +0 -1
- package/dist/rules/no-unwanted-polyfillio.cjs +0 -164
- package/dist/rules/no-unwanted-polyfillio.cjs.map +0 -1
- package/dist/rules/no-unwanted-polyfillio.d.cts +0 -5
- package/dist/rules/no-unwanted-polyfillio.d.ts +0 -5
- package/dist/rules/no-unwanted-polyfillio.js +0 -137
- package/dist/rules/no-unwanted-polyfillio.js.map +0 -1
- package/dist/utils/define-rule.cjs +0 -31
- package/dist/utils/define-rule.cjs.map +0 -1
- package/dist/utils/define-rule.d.cts +0 -5
- package/dist/utils/define-rule.d.ts +0 -5
- package/dist/utils/define-rule.js +0 -6
- package/dist/utils/define-rule.js.map +0 -1
- package/dist/utils/get-root-dirs.cjs +0 -60
- package/dist/utils/get-root-dirs.cjs.map +0 -1
- package/dist/utils/get-root-dirs.d.cts +0 -8
- package/dist/utils/get-root-dirs.d.ts +0 -8
- package/dist/utils/get-root-dirs.js +0 -25
- package/dist/utils/get-root-dirs.js.map +0 -1
- package/dist/utils/node-attributes.cjs +0 -67
- package/dist/utils/node-attributes.cjs.map +0 -1
- package/dist/utils/node-attributes.d.cts +0 -15
- package/dist/utils/node-attributes.d.ts +0 -15
- package/dist/utils/node-attributes.js +0 -46
- package/dist/utils/node-attributes.js.map +0 -1
- package/dist/utils/url.cjs +0 -167
- package/dist/utils/url.cjs.map +0 -1
- package/dist/utils/url.d.cts +0 -35
- package/dist/utils/url.d.ts +0 -35
- package/dist/utils/url.js +0 -128
- package/dist/utils/url.js.map +0 -1
@@ -1,267 +0,0 @@
|
|
1
|
-
// src/rules/no-html-link-for-pages.ts
|
2
|
-
import * as fs2 from "node:fs";
|
3
|
-
import * as path2 from "node:path";
|
4
|
-
|
5
|
-
// src/utils/define-rule.ts
|
6
|
-
var defineRule = (rule) => rule;
|
7
|
-
|
8
|
-
// src/utils/get-root-dirs.ts
|
9
|
-
import fastGlob from "fast-glob";
|
10
|
-
var processRootDir = (rootDir) => {
|
11
|
-
return fastGlob.globSync(rootDir.replaceAll("\\", "/"), {
|
12
|
-
onlyDirectories: true
|
13
|
-
});
|
14
|
-
};
|
15
|
-
var getRootDirs = (context) => {
|
16
|
-
let rootDirs = [context.cwd];
|
17
|
-
const nextSettings = (
|
18
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
19
|
-
context.settings.next || {}
|
20
|
-
);
|
21
|
-
const rootDir = nextSettings.rootDir;
|
22
|
-
if (typeof rootDir === "string") {
|
23
|
-
rootDirs = processRootDir(rootDir);
|
24
|
-
} else if (Array.isArray(rootDir)) {
|
25
|
-
rootDirs = rootDir.map((dir) => typeof dir === "string" ? processRootDir(dir) : []).flat();
|
26
|
-
}
|
27
|
-
return rootDirs;
|
28
|
-
};
|
29
|
-
|
30
|
-
// src/utils/url.ts
|
31
|
-
import * as fs from "node:fs";
|
32
|
-
import * as path from "node:path";
|
33
|
-
var fsReadDirSyncCache = {};
|
34
|
-
var parseUrlForPages = (urlprefix, directory) => {
|
35
|
-
fsReadDirSyncCache[directory] ??= fs.readdirSync(directory, {
|
36
|
-
withFileTypes: true
|
37
|
-
});
|
38
|
-
const res = [];
|
39
|
-
fsReadDirSyncCache[directory].forEach((dirent) => {
|
40
|
-
if (/(?<temp2>\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {
|
41
|
-
if (/^index(?<temp2>\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {
|
42
|
-
res.push(
|
43
|
-
`${urlprefix}${dirent.name.replace(/^index(?<temp2>\.(?<temp1>j|t)sx?)$/, "")}`
|
44
|
-
);
|
45
|
-
}
|
46
|
-
res.push(
|
47
|
-
`${urlprefix}${dirent.name.replace(/(?<temp2>\.(?<temp1>j|t)sx?)$/, "")}`
|
48
|
-
);
|
49
|
-
} else {
|
50
|
-
const dirPath = path.join(directory, dirent.name);
|
51
|
-
if (dirent.isDirectory() && !dirent.isSymbolicLink()) {
|
52
|
-
res.push(...parseUrlForPages(`${urlprefix + dirent.name}/`, dirPath));
|
53
|
-
}
|
54
|
-
}
|
55
|
-
});
|
56
|
-
return res;
|
57
|
-
};
|
58
|
-
var parseUrlForAppDir = (urlprefix, directory) => {
|
59
|
-
fsReadDirSyncCache[directory] ??= fs.readdirSync(directory, {
|
60
|
-
withFileTypes: true
|
61
|
-
});
|
62
|
-
const res = [];
|
63
|
-
fsReadDirSyncCache[directory].forEach((dirent) => {
|
64
|
-
if (/(?<temp2>\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {
|
65
|
-
if (/^page(?<temp2>\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {
|
66
|
-
res.push(
|
67
|
-
`${urlprefix}${dirent.name.replace(/^page(?<temp2>\.(?<temp1>j|t)sx?)$/, "")}`
|
68
|
-
);
|
69
|
-
} else if (!/^layout(?<temp2>\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {
|
70
|
-
res.push(
|
71
|
-
`${urlprefix}${dirent.name.replace(/(?<temp2>\.(?<temp1>j|t)sx?)$/, "")}`
|
72
|
-
);
|
73
|
-
}
|
74
|
-
} else {
|
75
|
-
const dirPath = path.join(directory, dirent.name);
|
76
|
-
if (dirent.isDirectory(dirPath) && !dirent.isSymbolicLink()) {
|
77
|
-
res.push(...parseUrlForPages(`${urlprefix + dirent.name}/`, dirPath));
|
78
|
-
}
|
79
|
-
}
|
80
|
-
});
|
81
|
-
return res;
|
82
|
-
};
|
83
|
-
var normalizeURL = (url2) => {
|
84
|
-
if (!url2) {
|
85
|
-
return;
|
86
|
-
}
|
87
|
-
url2 = url2.split("?", 1)[0];
|
88
|
-
url2 = url2.split("#", 1)[0];
|
89
|
-
url2 = url2.replace(/(?<temp1>\/index\.html)$/, "/");
|
90
|
-
if (url2 === "") {
|
91
|
-
return url2;
|
92
|
-
}
|
93
|
-
url2 = url2.endsWith("/") ? url2 : `${url2}/`;
|
94
|
-
return url2;
|
95
|
-
};
|
96
|
-
var normalizeAppPath = (route) => ensureLeadingSlash(
|
97
|
-
route.split("/").reduce((pathname, segment, index, segments) => {
|
98
|
-
if (!segment) {
|
99
|
-
return pathname;
|
100
|
-
}
|
101
|
-
if (isGroupSegment(segment)) {
|
102
|
-
return pathname;
|
103
|
-
}
|
104
|
-
if (segment.startsWith("@")) {
|
105
|
-
return pathname;
|
106
|
-
}
|
107
|
-
if ((segment === "page" || segment === "route") && index === segments.length - 1) {
|
108
|
-
return pathname;
|
109
|
-
}
|
110
|
-
return `${pathname}/${segment}`;
|
111
|
-
}, "")
|
112
|
-
);
|
113
|
-
var getUrlFromPagesDirectories = (urlPrefix, directories) => Array.from(
|
114
|
-
// De-duplicate similar pages across multiple directories.
|
115
|
-
new Set(
|
116
|
-
directories.flatMap((directory) => parseUrlForPages(urlPrefix, directory)).map(
|
117
|
-
// Since the URLs are normalized we add `^` and `$` to the RegExp to make sure they match exactly.
|
118
|
-
(url2) => `^${normalizeURL(url2)}$`
|
119
|
-
)
|
120
|
-
)
|
121
|
-
).map((urlReg) => {
|
122
|
-
urlReg = urlReg.replaceAll(/\[.*]/g, "((?!.+?\\..+?).*?)");
|
123
|
-
return new RegExp(urlReg);
|
124
|
-
});
|
125
|
-
var getUrlFromAppDirectory = (urlPrefix, directories) => Array.from(
|
126
|
-
// De-duplicate similar pages across multiple directories.
|
127
|
-
new Set(
|
128
|
-
directories.map((directory) => parseUrlForAppDir(urlPrefix, directory)).flat().map(
|
129
|
-
// Since the URLs are normalized we add `^` and `$` to the RegExp to make sure they match exactly.
|
130
|
-
(url2) => `^${normalizeAppPath(url2)}$`
|
131
|
-
)
|
132
|
-
)
|
133
|
-
).map((urlReg) => {
|
134
|
-
urlReg = urlReg.replaceAll(/\[.*]/g, "((?!.+?\\..+?).*?)");
|
135
|
-
return new RegExp(urlReg);
|
136
|
-
});
|
137
|
-
var execOnce = (fn) => {
|
138
|
-
let used = false;
|
139
|
-
let result;
|
140
|
-
return (...args) => {
|
141
|
-
if (!used) {
|
142
|
-
used = true;
|
143
|
-
result = fn(...args);
|
144
|
-
}
|
145
|
-
return result;
|
146
|
-
};
|
147
|
-
};
|
148
|
-
var ensureLeadingSlash = (route) => route.startsWith("/") ? route : `/${route}`;
|
149
|
-
var isGroupSegment = (segment) => segment.startsWith("(") && segment.endsWith(")");
|
150
|
-
|
151
|
-
// src/rules/no-html-link-for-pages.ts
|
152
|
-
var pagesDirWarning = execOnce((pagesDirs) => {
|
153
|
-
console.warn(
|
154
|
-
`Pages directory cannot be found at ${pagesDirs.join(" or ")}. If using a custom path, please configure with the \`no-html-link-for-pages\` rule in your eslint config file.`
|
155
|
-
);
|
156
|
-
});
|
157
|
-
var fsExistsSyncCache = {};
|
158
|
-
var memoize = (fn) => {
|
159
|
-
const cache = {};
|
160
|
-
return (...args) => {
|
161
|
-
const key = JSON.stringify(args);
|
162
|
-
cache[key] ??= fn(...args);
|
163
|
-
return cache[key];
|
164
|
-
};
|
165
|
-
};
|
166
|
-
var cachedGetUrlFromPagesDirectories = memoize(getUrlFromPagesDirectories);
|
167
|
-
var cachedGetUrlFromAppDirectory = memoize(getUrlFromAppDirectory);
|
168
|
-
var url = "https://nextjs.org/docs/messages/no-html-link-for-pages";
|
169
|
-
var noHtmlLinkForPages = defineRule({
|
170
|
-
/**
|
171
|
-
* Creates an ESLint rule listener.
|
172
|
-
*/
|
173
|
-
create: (context) => {
|
174
|
-
const ruleOptions = context.options;
|
175
|
-
const [customPagesDirectory] = ruleOptions;
|
176
|
-
const rootDirs = getRootDirs(context);
|
177
|
-
const pagesDirs = (customPagesDirectory ? [customPagesDirectory] : rootDirs.map((dir) => [
|
178
|
-
path2.join(dir, "pages"),
|
179
|
-
path2.join(dir, "src", "pages")
|
180
|
-
])).flat();
|
181
|
-
const foundPagesDirs = pagesDirs.filter((dir) => {
|
182
|
-
fsExistsSyncCache[dir] ??= fs2.existsSync(dir);
|
183
|
-
return fsExistsSyncCache[dir];
|
184
|
-
});
|
185
|
-
const appDirs = rootDirs.map((dir) => [path2.join(dir, "app"), path2.join(dir, "src", "app")]).flat();
|
186
|
-
const foundAppDirs = appDirs.filter((dir) => {
|
187
|
-
fsExistsSyncCache[dir] ??= fs2.existsSync(dir);
|
188
|
-
return fsExistsSyncCache[dir];
|
189
|
-
});
|
190
|
-
if (foundPagesDirs.length === 0 && foundAppDirs.length === 0) {
|
191
|
-
pagesDirWarning(pagesDirs);
|
192
|
-
return {};
|
193
|
-
}
|
194
|
-
const pageUrls = cachedGetUrlFromPagesDirectories("/", foundPagesDirs);
|
195
|
-
const appDirUrls = cachedGetUrlFromAppDirectory("/", foundAppDirs);
|
196
|
-
const allUrlRegex = [...pageUrls, ...appDirUrls];
|
197
|
-
return {
|
198
|
-
JSXOpeningElement: (node) => {
|
199
|
-
if (node.name.name !== "a") {
|
200
|
-
return;
|
201
|
-
}
|
202
|
-
if (node.attributes.length === 0) {
|
203
|
-
return;
|
204
|
-
}
|
205
|
-
const target = node.attributes.find(
|
206
|
-
(attr) => attr.type === "JSXAttribute" && attr.name.name === "target"
|
207
|
-
);
|
208
|
-
if (target && target.value.value === "_blank") {
|
209
|
-
return;
|
210
|
-
}
|
211
|
-
const href = node.attributes.find(
|
212
|
-
(attr) => attr.type === "JSXAttribute" && attr.name.name === "href"
|
213
|
-
);
|
214
|
-
if (!href || href.value && href.value.type !== "Literal") {
|
215
|
-
return;
|
216
|
-
}
|
217
|
-
const hasDownloadAttr = node.attributes.find(
|
218
|
-
(attr) => attr.type === "JSXAttribute" && attr.name.name === "download"
|
219
|
-
);
|
220
|
-
if (hasDownloadAttr) {
|
221
|
-
return;
|
222
|
-
}
|
223
|
-
const hrefPath = normalizeURL(href.value.value);
|
224
|
-
if (/^(?<temp1>https?:\/\/|\/\/)/.test(hrefPath)) {
|
225
|
-
return;
|
226
|
-
}
|
227
|
-
allUrlRegex.forEach((foundUrl) => {
|
228
|
-
if (hrefPath && foundUrl.test(normalizeURL(hrefPath))) {
|
229
|
-
context.report({
|
230
|
-
message: `Do not use an \`<a>\` element to navigate to \`${hrefPath}\`. Use \`<Link />\` from \`next/link\` instead. See: ${url}`,
|
231
|
-
node
|
232
|
-
});
|
233
|
-
}
|
234
|
-
});
|
235
|
-
}
|
236
|
-
};
|
237
|
-
},
|
238
|
-
meta: {
|
239
|
-
docs: {
|
240
|
-
category: "HTML",
|
241
|
-
description: "Prevent usage of `<a>` elements to navigate to internal Next.js pages.",
|
242
|
-
recommended: true,
|
243
|
-
url
|
244
|
-
},
|
245
|
-
schema: [
|
246
|
-
{
|
247
|
-
oneOf: [
|
248
|
-
{
|
249
|
-
type: "string"
|
250
|
-
},
|
251
|
-
{
|
252
|
-
items: {
|
253
|
-
type: "string"
|
254
|
-
},
|
255
|
-
type: "array",
|
256
|
-
uniqueItems: true
|
257
|
-
}
|
258
|
-
]
|
259
|
-
}
|
260
|
-
],
|
261
|
-
type: "problem"
|
262
|
-
}
|
263
|
-
});
|
264
|
-
export {
|
265
|
-
noHtmlLinkForPages
|
266
|
-
};
|
267
|
-
//# sourceMappingURL=no-html-link-for-pages.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/rules/no-html-link-for-pages.ts","../../src/utils/define-rule.ts","../../src/utils/get-root-dirs.ts","../../src/utils/url.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nimport { defineRule } from \"../utils/define-rule.js\";\nimport { getRootDirs } from \"../utils/get-root-dirs.js\";\nimport {\n execOnce,\n getUrlFromAppDirectory,\n getUrlFromPagesDirectories,\n normalizeURL,\n} from \"../utils/url.js\";\n\nconst pagesDirWarning = execOnce((pagesDirs) => {\n console.warn(\n `Pages directory cannot be found at ${pagesDirs.join(\" or \")}. ` +\n \"If using a custom path, please configure with the `no-html-link-for-pages` rule in your eslint config file.\",\n );\n});\n\n// Cache for fs.existsSync lookup.\n// Prevent multiple blocking IO requests that have already been calculated.\nconst fsExistsSyncCache: Record<string, boolean> = {};\n\nconst memoize = <T = any>(fn: (...args: any[]) => T) => {\n const cache: Record<string, T> = {};\n return (...args: any[]): T => {\n const key = JSON.stringify(args);\n cache[key] ??= fn(...args);\n return cache[key];\n };\n};\n\nconst cachedGetUrlFromPagesDirectories = memoize(getUrlFromPagesDirectories);\nconst cachedGetUrlFromAppDirectory = memoize(getUrlFromAppDirectory);\n\nconst url = \"https://nextjs.org/docs/messages/no-html-link-for-pages\";\n\nexport const noHtmlLinkForPages = defineRule({\n /**\n * Creates an ESLint rule listener.\n */\n create: (context) => {\n // @ts-expect-error initial override, TODO: fix\n const ruleOptions: (string | string[])[] = context.options;\n const [customPagesDirectory] = ruleOptions;\n\n const rootDirs = getRootDirs(context);\n\n const pagesDirs = (\n customPagesDirectory ?\n [customPagesDirectory]\n : rootDirs.map((dir) => [\n path.join(dir, \"pages\"),\n path.join(dir, \"src\", \"pages\"),\n ])).flat();\n\n const foundPagesDirs = pagesDirs.filter((dir) => {\n fsExistsSyncCache[dir] ??= fs.existsSync(dir);\n return fsExistsSyncCache[dir];\n });\n\n const appDirs = rootDirs\n .map((dir) => [path.join(dir, \"app\"), path.join(dir, \"src\", \"app\")])\n .flat();\n\n const foundAppDirs = appDirs.filter((dir) => {\n fsExistsSyncCache[dir] ??= fs.existsSync(dir);\n return fsExistsSyncCache[dir];\n });\n\n // warn if there are no pages and app directories\n if (foundPagesDirs.length === 0 && foundAppDirs.length === 0) {\n pagesDirWarning(pagesDirs);\n return {};\n }\n\n const pageUrls = cachedGetUrlFromPagesDirectories(\"/\", foundPagesDirs);\n const appDirUrls = cachedGetUrlFromAppDirectory(\"/\", foundAppDirs);\n const allUrlRegex = [...pageUrls, ...appDirUrls];\n\n return {\n JSXOpeningElement: (node: any) => {\n if (node.name.name !== \"a\") {\n return;\n }\n\n if (node.attributes.length === 0) {\n return;\n }\n\n const target = node.attributes.find(\n (attr: any) =>\n attr.type === \"JSXAttribute\" && attr.name.name === \"target\",\n );\n\n if (target && target.value.value === \"_blank\") {\n return;\n }\n\n const href = node.attributes.find(\n (attr: any) =>\n attr.type === \"JSXAttribute\" && attr.name.name === \"href\",\n );\n\n if (!href || (href.value && href.value.type !== \"Literal\")) {\n return;\n }\n\n const hasDownloadAttr = node.attributes.find(\n (attr: any) =>\n attr.type === \"JSXAttribute\" && attr.name.name === \"download\",\n );\n\n if (hasDownloadAttr) {\n return;\n }\n\n const hrefPath = normalizeURL(href.value.value);\n // Outgoing links are ignored\n\n if (/^(?<temp1>https?:\\/\\/|\\/\\/)/.test(hrefPath as string)) {\n return;\n }\n\n allUrlRegex.forEach((foundUrl) => {\n if (hrefPath && foundUrl.test(normalizeURL(hrefPath) as string)) {\n context.report({\n message: `Do not use an \\`<a>\\` element to navigate to \\`${hrefPath}\\`. Use \\`<Link />\\` from \\`next/link\\` instead. See: ${url}`,\n node,\n });\n }\n });\n },\n };\n },\n\n meta: {\n docs: {\n category: \"HTML\",\n description:\n \"Prevent usage of `<a>` elements to navigate to internal Next.js pages.\",\n recommended: true,\n url,\n },\n schema: [\n {\n oneOf: [\n {\n type: \"string\",\n },\n {\n items: {\n type: \"string\",\n },\n type: \"array\",\n uniqueItems: true,\n },\n ],\n },\n ],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n","import type { Rule } from \"eslint\";\n\nimport fastGlob from \"fast-glob\";\n\n/**\n * Process a Next.js root directory glob.\n */\nconst processRootDir = (rootDir: string): string[] => {\n return fastGlob.globSync(rootDir.replaceAll(\"\\\\\", \"/\"), {\n onlyDirectories: true,\n });\n};\n\n/**\n * Gets one or more Root, returns an array of root directories.\n */\nexport const getRootDirs = (context: Rule.RuleContext) => {\n let rootDirs = [context.cwd];\n\n const nextSettings: { rootDir?: string | string[] } =\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n context.settings.next || {};\n const rootDir = nextSettings.rootDir;\n\n if (typeof rootDir === \"string\") {\n rootDirs = processRootDir(rootDir);\n } else if (Array.isArray(rootDir)) {\n rootDirs = rootDir\n .map((dir) => (typeof dir === \"string\" ? processRootDir(dir) : []))\n .flat();\n }\n\n return rootDirs;\n};\n","import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\n// Cache for fs.readdirSync lookup.\n// Prevent multiple blocking IO requests that have already been calculated.\nconst fsReadDirSyncCache: Record<string, fs.Dirent[]> = {};\n\n/**\n * Recursively parse directory for page URLs.\n */\nconst parseUrlForPages = (urlprefix: string, directory: string) => {\n fsReadDirSyncCache[directory] ??= fs.readdirSync(directory, {\n withFileTypes: true,\n });\n const res: string[] = [];\n fsReadDirSyncCache[directory].forEach((dirent) => {\n // TODO: this should account for all page extensions\n // not just js(x) and ts(x)\n if (/(?<temp2>\\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {\n if (/^index(?<temp2>\\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {\n res.push(\n `${urlprefix}${dirent.name.replace(/^index(?<temp2>\\.(?<temp1>j|t)sx?)$/, \"\")}`,\n );\n }\n res.push(\n `${urlprefix}${dirent.name.replace(/(?<temp2>\\.(?<temp1>j|t)sx?)$/, \"\")}`,\n );\n } else {\n const dirPath = path.join(directory, dirent.name);\n if (dirent.isDirectory() && !dirent.isSymbolicLink()) {\n res.push(...parseUrlForPages(`${urlprefix + dirent.name}/`, dirPath));\n }\n }\n });\n return res;\n};\n\n/**\n * Recursively parse app directory for URLs.\n */\nconst parseUrlForAppDir = (urlprefix: string, directory: string) => {\n fsReadDirSyncCache[directory] ??= fs.readdirSync(directory, {\n withFileTypes: true,\n });\n const res: string[] = [];\n fsReadDirSyncCache[directory].forEach((dirent) => {\n // TODO: this should account for all page extensions\n // not just js(x) and ts(x)\n if (/(?<temp2>\\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {\n if (/^page(?<temp2>\\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {\n res.push(\n `${urlprefix}${dirent.name.replace(/^page(?<temp2>\\.(?<temp1>j|t)sx?)$/, \"\")}`,\n );\n } else if (!/^layout(?<temp2>\\.(?<temp1>j|t)sx?)$/.test(dirent.name)) {\n res.push(\n `${urlprefix}${dirent.name.replace(/(?<temp2>\\.(?<temp1>j|t)sx?)$/, \"\")}`,\n );\n }\n } else {\n const dirPath = path.join(directory, dirent.name);\n // @ts-expect-error - types suggest this shouldn't take an arg, but I don't want to change anything\n if (dirent.isDirectory(dirPath) && !dirent.isSymbolicLink()) {\n res.push(...parseUrlForPages(`${urlprefix + dirent.name}/`, dirPath));\n }\n }\n });\n return res;\n};\n\n/**\n * Takes a URL and does the following things.\n * - Replaces `index.html` with `/`\n * - Makes sure all URLs are have a trailing `/`\n * - Removes query string\n */\nexport const normalizeURL = (url: string) => {\n if (!url) {\n return;\n }\n url = url.split(\"?\", 1)[0] as string;\n url = url.split(\"#\", 1)[0] as string;\n url = url.replace(/(?<temp1>\\/index\\.html)$/, \"/\");\n // Empty URLs should not be trailed with `/`, e.g. `#heading`\n if (url === \"\") {\n return url;\n }\n url = url.endsWith(\"/\") ? url : `${url}/`;\n return url;\n};\n\n/**\n * Normalizes an app route so it represents the actual request path. Essentially\n * performing the following transformations:\n *\n * - `/(dashboard)/user/[id]/page` to `/user/[id]`\n * - `/(dashboard)/account/page` to `/account`\n * - `/user/[id]/page` to `/user/[id]`\n * - `/account/page` to `/account`\n * - `/page` to `/`\n * - `/(dashboard)/user/[id]/route` to `/user/[id]`\n * - `/(dashboard)/account/route` to `/account`\n * - `/user/[id]/route` to `/user/[id]`\n * - `/account/route` to `/account`\n * - `/route` to `/`\n * - `/` to `/`\n *\n * @param route the app route to normalize\n * @returns the normalized pathname\n */\nexport const normalizeAppPath = (route: string) =>\n ensureLeadingSlash(\n route.split(\"/\").reduce((pathname, segment, index, segments) => {\n // Empty segments are ignored.\n if (!segment) {\n return pathname;\n }\n\n // Groups are ignored.\n if (isGroupSegment(segment)) {\n return pathname;\n }\n\n // Parallel segments are ignored.\n if (segment.startsWith(\"@\")) {\n return pathname;\n }\n\n // The last segment (if it's a leaf) should be ignored.\n if (\n (segment === \"page\" || segment === \"route\") &&\n index === segments.length - 1\n ) {\n return pathname;\n }\n\n return `${pathname}/${segment}`;\n }, \"\"),\n );\n\n/**\n * Gets the possible URLs from a directory.\n */\nexport const getUrlFromPagesDirectories = (\n urlPrefix: string,\n directories: string[],\n) =>\n Array.from(\n // De-duplicate similar pages across multiple directories.\n new Set(\n directories\n .flatMap((directory) => parseUrlForPages(urlPrefix, directory))\n .map(\n // Since the URLs are normalized we add `^` and `$` to the RegExp to make sure they match exactly.\n (url) => `^${normalizeURL(url)}$`,\n ),\n ),\n ).map((urlReg) => {\n urlReg = urlReg.replaceAll(/\\[.*]/g, \"((?!.+?\\\\..+?).*?)\");\n return new RegExp(urlReg);\n });\n\nexport const getUrlFromAppDirectory = (\n urlPrefix: string,\n directories: string[],\n) =>\n Array.from(\n // De-duplicate similar pages across multiple directories.\n new Set(\n directories\n .map((directory) => parseUrlForAppDir(urlPrefix, directory))\n .flat()\n .map(\n // Since the URLs are normalized we add `^` and `$` to the RegExp to make sure they match exactly.\n (url) => `^${normalizeAppPath(url)}$`,\n ),\n ),\n ).map((urlReg) => {\n urlReg = urlReg.replaceAll(/\\[.*]/g, \"((?!.+?\\\\..+?).*?)\");\n return new RegExp(urlReg);\n });\n\nexport const execOnce = <TArgs extends any[], TResult>(\n fn: (...args: TArgs) => TResult,\n): ((...args: TArgs) => TResult) => {\n let used = false;\n let result: TResult;\n\n return (...args: TArgs) => {\n if (!used) {\n used = true;\n result = fn(...args);\n }\n return result;\n };\n};\n\nconst ensureLeadingSlash = (route: string) =>\n route.startsWith(\"/\") ? route : `/${route}`;\n\nconst isGroupSegment = (segment: string) =>\n segment.startsWith(\"(\") && segment.endsWith(\")\");\n"],"mappings":";AAAA,YAAYA,SAAQ;AACpB,YAAYC,WAAU;;;ACCf,IAAM,aAAa,CAAC,SAA2C;;;ACAtE,OAAO,cAAc;AAKrB,IAAM,iBAAiB,CAAC,YAA8B;AACpD,SAAO,SAAS,SAAS,QAAQ,WAAW,MAAM,GAAG,GAAG;AAAA,IACtD,iBAAiB;AAAA,EACnB,CAAC;AACH;AAKO,IAAM,cAAc,CAAC,YAA8B;AACxD,MAAI,WAAW,CAAC,QAAQ,GAAG;AAE3B,QAAM;AAAA;AAAA,IAEJ,QAAQ,SAAS,QAAQ,CAAC;AAAA;AAC5B,QAAM,UAAU,aAAa;AAE7B,MAAI,OAAO,YAAY,UAAU;AAC/B,eAAW,eAAe,OAAO;AAAA,EACnC,WAAW,MAAM,QAAQ,OAAO,GAAG;AACjC,eAAW,QACR,IAAI,CAAC,QAAS,OAAO,QAAQ,WAAW,eAAe,GAAG,IAAI,CAAC,CAAE,EACjE,KAAK;AAAA,EACV;AAEA,SAAO;AACT;;;ACjCA,YAAY,QAAQ;AACpB,YAAY,UAAU;AAItB,IAAM,qBAAkD,CAAC;AAKzD,IAAM,mBAAmB,CAAC,WAAmB,cAAsB;AACjE,qBAAmB,SAAS,MAAS,eAAY,WAAW;AAAA,IAC1D,eAAe;AAAA,EACjB,CAAC;AACD,QAAM,MAAgB,CAAC;AACvB,qBAAmB,SAAS,EAAE,QAAQ,CAAC,WAAW;AAGhD,QAAI,gCAAgC,KAAK,OAAO,IAAI,GAAG;AACrD,UAAI,sCAAsC,KAAK,OAAO,IAAI,GAAG;AAC3D,YAAI;AAAA,UACF,GAAG,SAAS,GAAG,O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S,kBAAkB,KAAK,KAAK,SAAS;AAAA,QACvD;AAEA,YAAI,iBAAiB;AACnB;AAAA,QACF;AAEA,cAAM,WAAW,aAAa,KAAK,MAAM,KAAK;AAG9C,YAAI,8BAA8B,KAAK,QAAkB,GAAG;AAC1D;AAAA,QACF;AAEA,oBAAY,QAAQ,CAAC,aAAa;AAChC,cAAI,YAAY,SAAS,KAAK,aAAa,QAAQ,CAAW,GAAG;AAC/D,oBAAQ,OAAO;AAAA,cACb,SAAS,kDAAkD,QAAQ,yDAAyD,GAAG;AAAA,cAC/H;AAAA,YACF,CAAC;AAAA,UACH;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EAEA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,aACE;AAAA,MACF,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,QACE,OAAO;AAAA,UACL;AAAA,YACE,MAAM;AAAA,UACR;AAAA,UACA;AAAA,YACE,OAAO;AAAA,cACL,MAAM;AAAA,YACR;AAAA,YACA,MAAM;AAAA,YACN,aAAa;AAAA,UACf;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA,MAAM;AAAA,EACR;AACF,CAAC;","names":["fs","path","url"]}
|
@@ -1,83 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __create = Object.create;
|
3
|
-
var __defProp = Object.defineProperty;
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
-
var __export = (target, all) => {
|
9
|
-
for (var name in all)
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
11
|
-
};
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
14
|
-
for (let key of __getOwnPropNames(from))
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
17
|
-
}
|
18
|
-
return to;
|
19
|
-
};
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
26
|
-
mod
|
27
|
-
));
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
29
|
-
|
30
|
-
// src/rules/no-img-element.ts
|
31
|
-
var no_img_element_exports = {};
|
32
|
-
__export(no_img_element_exports, {
|
33
|
-
noImgElement: () => noImgElement
|
34
|
-
});
|
35
|
-
module.exports = __toCommonJS(no_img_element_exports);
|
36
|
-
var import_node_path = __toESM(require("path"), 1);
|
37
|
-
|
38
|
-
// src/utils/define-rule.ts
|
39
|
-
var defineRule = (rule) => rule;
|
40
|
-
|
41
|
-
// src/rules/no-img-element.ts
|
42
|
-
var url = "https://nextjs.org/docs/messages/no-img-element";
|
43
|
-
var noImgElement = defineRule({
|
44
|
-
create: (context) => {
|
45
|
-
const relativePath = context.filename.replace(import_node_path.default.sep, "/").replace(context.cwd, "").replace(/^\//, "");
|
46
|
-
const isAppDir = /^(?<temp1>src\/)?app\//.test(relativePath);
|
47
|
-
return {
|
48
|
-
JSXOpeningElement: (node) => {
|
49
|
-
if (node.name.name !== "img") {
|
50
|
-
return;
|
51
|
-
}
|
52
|
-
if (node.attributes.length === 0) {
|
53
|
-
return;
|
54
|
-
}
|
55
|
-
if (node.parent?.parent?.openingElement?.name?.name === "picture") {
|
56
|
-
return;
|
57
|
-
}
|
58
|
-
if (isAppDir && /\/opengraph-image|twitter-image|icon\.\w+$/.test(relativePath)) {
|
59
|
-
return;
|
60
|
-
}
|
61
|
-
context.report({
|
62
|
-
message: `Using \`<img>\` could result in slower LCP and higher bandwidth. Consider using \`<Image />\` from \`next/image\` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: ${url}`,
|
63
|
-
node
|
64
|
-
});
|
65
|
-
}
|
66
|
-
};
|
67
|
-
},
|
68
|
-
meta: {
|
69
|
-
docs: {
|
70
|
-
category: "HTML",
|
71
|
-
description: "Prevent usage of `<img>` element due to slower LCP and higher bandwidth.",
|
72
|
-
recommended: true,
|
73
|
-
url
|
74
|
-
},
|
75
|
-
schema: [],
|
76
|
-
type: "problem"
|
77
|
-
}
|
78
|
-
});
|
79
|
-
// Annotate the CommonJS export names for ESM import in node:
|
80
|
-
0 && (module.exports = {
|
81
|
-
noImgElement
|
82
|
-
});
|
83
|
-
//# sourceMappingURL=no-img-element.cjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/rules/no-img-element.ts","../../src/utils/define-rule.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { defineRule } from \"../utils/define-rule.js\";\n\nconst url = \"https://nextjs.org/docs/messages/no-img-element\";\n\nexport const noImgElement = defineRule({\n create: (context: any) => {\n // Get relative path of the file\n const relativePath = context.filename\n .replace(path.sep, \"/\")\n .replace(context.cwd, \"\")\n .replace(/^\\//, \"\");\n\n const isAppDir = /^(?<temp1>src\\/)?app\\//.test(relativePath);\n\n return {\n JSXOpeningElement: (node: any) => {\n if (node.name.name !== \"img\") {\n return;\n }\n\n if (node.attributes.length === 0) {\n return;\n }\n\n if (node.parent?.parent?.openingElement?.name?.name === \"picture\") {\n return;\n }\n\n // If is metadata route files, ignore\n // e.g. opengraph-image.js, twitter-image.js, icon.js\n if (\n isAppDir &&\n /\\/opengraph-image|twitter-image|icon\\.\\w+$/.test(relativePath)\n ) {\n return;\n }\n\n context.report({\n message: `Using \\`<img>\\` could result in slower LCP and higher bandwidth. Consider using \\`<Image />\\` from \\`next/image\\` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: ${url}`,\n node,\n });\n },\n };\n },\n meta: {\n docs: {\n category: \"HTML\",\n description:\n \"Prevent usage of `<img>` element due to slower LCP and higher bandwidth.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAiB;;;ACEV,IAAM,aAAa,CAAC,SAA2C;;;ADEtE,IAAM,MAAM;AAEL,IAAM,eAAe,WAAW;AAAA,EACrC,QAAQ,CAAC,YAAiB;AAExB,UAAM,eAAe,QAAQ,SAC1B,QAAQ,iBAAAA,QAAK,KAAK,GAAG,EACrB,QAAQ,QAAQ,KAAK,EAAE,EACvB,QAAQ,OAAO,EAAE;AAEpB,UAAM,WAAW,yBAAyB,KAAK,YAAY;AAE3D,WAAO;AAAA,MACL,mBAAmB,CAAC,SAAc;AAChC,YAAI,KAAK,KAAK,SAAS,OAAO;AAC5B;AAAA,QACF;AAEA,YAAI,KAAK,WAAW,WAAW,GAAG;AAChC;AAAA,QACF;AAEA,YAAI,KAAK,QAAQ,QAAQ,gBAAgB,MAAM,SAAS,WAAW;AACjE;AAAA,QACF;AAIA,YACE,YACA,6CAA6C,KAAK,YAAY,GAC9D;AACA;AAAA,QACF;AAEA,gBAAQ,OAAO;AAAA,UACb,SAAS,iPAAiP,GAAG;AAAA,UAC7P;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,aACE;AAAA,MACF,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":["path"]}
|
@@ -1,48 +0,0 @@
|
|
1
|
-
// src/rules/no-img-element.ts
|
2
|
-
import path from "node:path";
|
3
|
-
|
4
|
-
// src/utils/define-rule.ts
|
5
|
-
var defineRule = (rule) => rule;
|
6
|
-
|
7
|
-
// src/rules/no-img-element.ts
|
8
|
-
var url = "https://nextjs.org/docs/messages/no-img-element";
|
9
|
-
var noImgElement = defineRule({
|
10
|
-
create: (context) => {
|
11
|
-
const relativePath = context.filename.replace(path.sep, "/").replace(context.cwd, "").replace(/^\//, "");
|
12
|
-
const isAppDir = /^(?<temp1>src\/)?app\//.test(relativePath);
|
13
|
-
return {
|
14
|
-
JSXOpeningElement: (node) => {
|
15
|
-
if (node.name.name !== "img") {
|
16
|
-
return;
|
17
|
-
}
|
18
|
-
if (node.attributes.length === 0) {
|
19
|
-
return;
|
20
|
-
}
|
21
|
-
if (node.parent?.parent?.openingElement?.name?.name === "picture") {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
if (isAppDir && /\/opengraph-image|twitter-image|icon\.\w+$/.test(relativePath)) {
|
25
|
-
return;
|
26
|
-
}
|
27
|
-
context.report({
|
28
|
-
message: `Using \`<img>\` could result in slower LCP and higher bandwidth. Consider using \`<Image />\` from \`next/image\` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: ${url}`,
|
29
|
-
node
|
30
|
-
});
|
31
|
-
}
|
32
|
-
};
|
33
|
-
},
|
34
|
-
meta: {
|
35
|
-
docs: {
|
36
|
-
category: "HTML",
|
37
|
-
description: "Prevent usage of `<img>` element due to slower LCP and higher bandwidth.",
|
38
|
-
recommended: true,
|
39
|
-
url
|
40
|
-
},
|
41
|
-
schema: [],
|
42
|
-
type: "problem"
|
43
|
-
}
|
44
|
-
});
|
45
|
-
export {
|
46
|
-
noImgElement
|
47
|
-
};
|
48
|
-
//# sourceMappingURL=no-img-element.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/rules/no-img-element.ts","../../src/utils/define-rule.ts"],"sourcesContent":["import path from \"node:path\";\n\nimport { defineRule } from \"../utils/define-rule.js\";\n\nconst url = \"https://nextjs.org/docs/messages/no-img-element\";\n\nexport const noImgElement = defineRule({\n create: (context: any) => {\n // Get relative path of the file\n const relativePath = context.filename\n .replace(path.sep, \"/\")\n .replace(context.cwd, \"\")\n .replace(/^\\//, \"\");\n\n const isAppDir = /^(?<temp1>src\\/)?app\\//.test(relativePath);\n\n return {\n JSXOpeningElement: (node: any) => {\n if (node.name.name !== \"img\") {\n return;\n }\n\n if (node.attributes.length === 0) {\n return;\n }\n\n if (node.parent?.parent?.openingElement?.name?.name === \"picture\") {\n return;\n }\n\n // If is metadata route files, ignore\n // e.g. opengraph-image.js, twitter-image.js, icon.js\n if (\n isAppDir &&\n /\\/opengraph-image|twitter-image|icon\\.\\w+$/.test(relativePath)\n ) {\n return;\n }\n\n context.report({\n message: `Using \\`<img>\\` could result in slower LCP and higher bandwidth. Consider using \\`<Image />\\` from \\`next/image\\` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: ${url}`,\n node,\n });\n },\n };\n },\n meta: {\n docs: {\n category: \"HTML\",\n description:\n \"Prevent usage of `<img>` element due to slower LCP and higher bandwidth.\",\n recommended: true,\n url,\n },\n schema: [],\n type: \"problem\",\n },\n});\n","import type { Rule } from \"eslint\";\n\nexport const defineRule = (rule: Rule.RuleModule): Rule.RuleModule => rule;\n"],"mappings":";AAAA,OAAO,UAAU;;;ACEV,IAAM,aAAa,CAAC,SAA2C;;;ADEtE,IAAM,MAAM;AAEL,IAAM,eAAe,WAAW;AAAA,EACrC,QAAQ,CAAC,YAAiB;AAExB,UAAM,eAAe,QAAQ,SAC1B,QAAQ,KAAK,KAAK,GAAG,EACrB,QAAQ,QAAQ,KAAK,EAAE,EACvB,QAAQ,OAAO,EAAE;AAEpB,UAAM,WAAW,yBAAyB,KAAK,YAAY;AAE3D,WAAO;AAAA,MACL,mBAAmB,CAAC,SAAc;AAChC,YAAI,KAAK,KAAK,SAAS,OAAO;AAC5B;AAAA,QACF;AAEA,YAAI,KAAK,WAAW,WAAW,GAAG;AAChC;AAAA,QACF;AAEA,YAAI,KAAK,QAAQ,QAAQ,gBAAgB,MAAM,SAAS,WAAW;AACjE;AAAA,QACF;AAIA,YACE,YACA,6CAA6C,KAAK,YAAY,GAC9D;AACA;AAAA,QACF;AAEA,gBAAQ,OAAO;AAAA,UACb,SAAS,iPAAiP,GAAG;AAAA,UAC7P;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAAA,EACA,MAAM;AAAA,IACJ,MAAM;AAAA,MACJ,UAAU;AAAA,MACV,aACE;AAAA,MACF,aAAa;AAAA,MACb;AAAA,IACF;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,MAAM;AAAA,EACR;AACF,CAAC;","names":[]}
|
@@ -1,184 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __defProp = Object.defineProperty;
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
-
var __export = (target, all) => {
|
7
|
-
for (var name in all)
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
-
};
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
-
for (let key of __getOwnPropNames(from))
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
-
}
|
16
|
-
return to;
|
17
|
-
};
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
-
|
20
|
-
// src/rules/no-page-custom-font.ts
|
21
|
-
var no_page_custom_font_exports = {};
|
22
|
-
__export(no_page_custom_font_exports, {
|
23
|
-
noPageCustomFont: () => noPageCustomFont
|
24
|
-
});
|
25
|
-
module.exports = __toCommonJS(no_page_custom_font_exports);
|
26
|
-
var import_node_path = require("path");
|
27
|
-
|
28
|
-
// src/utils/define-rule.ts
|
29
|
-
var defineRule = (rule) => rule;
|
30
|
-
|
31
|
-
// src/utils/node-attributes.ts
|
32
|
-
var NodeAttributes = class {
|
33
|
-
attributes;
|
34
|
-
constructor(ASTnode) {
|
35
|
-
this.attributes = {};
|
36
|
-
ASTnode.attributes.forEach((attribute) => {
|
37
|
-
if (!attribute.type || attribute.type !== "JSXAttribute") {
|
38
|
-
return;
|
39
|
-
}
|
40
|
-
if (attribute.value) {
|
41
|
-
const value = typeof attribute.value.value === "string" ? attribute.value.value : typeof attribute.value.expression?.value !== "undefined" ? attribute.value.expression.value : attribute.value.expression?.properties;
|
42
|
-
this.attributes[attribute.name.name] = {
|
43
|
-
hasValue: true,
|
44
|
-
value
|
45
|
-
};
|
46
|
-
} else {
|
47
|
-
this.attributes[attribute.name.name] = {
|
48
|
-
hasValue: false
|
49
|
-
};
|
50
|
-
}
|
51
|
-
});
|
52
|
-
}
|
53
|
-
has(attrName) {
|
54
|
-
return Boolean(this.attributes[attrName]);
|
55
|
-
}
|
56
|
-
hasAny() {
|
57
|
-
return Boolean(Object.keys(this.attributes).length);
|
58
|
-
}
|
59
|
-
hasValue(attrName) {
|
60
|
-
return Boolean(this.attributes[attrName]?.hasValue);
|
61
|
-
}
|
62
|
-
value(attrName) {
|
63
|
-
const attr = this.attributes[attrName];
|
64
|
-
if (!attr) {
|
65
|
-
return true;
|
66
|
-
}
|
67
|
-
if ("hasValue" in attr && attr.hasValue) {
|
68
|
-
return attr.value;
|
69
|
-
}
|
70
|
-
return void 0;
|
71
|
-
}
|
72
|
-
};
|
73
|
-
|
74
|
-
// src/rules/no-page-custom-font.ts
|
75
|
-
var url = "https://nextjs.org/docs/messages/no-page-custom-font";
|
76
|
-
var isIdentifierMatch = (id1, id2) => id1 === null && id2 === null || id1 && id2 && id1.name === id2.name;
|
77
|
-
var noPageCustomFont = defineRule({
|
78
|
-
create: (context) => {
|
79
|
-
const { sourceCode } = context;
|
80
|
-
const paths = context.filename.split("pages");
|
81
|
-
const page = paths[paths.length - 1];
|
82
|
-
if (!page) {
|
83
|
-
return {};
|
84
|
-
}
|
85
|
-
const isDocument = (
|
86
|
-
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
87
|
-
page.startsWith(`${import_node_path.sep}_document`) || page.startsWith(`${import_node_path.posix.sep}_document`)
|
88
|
-
);
|
89
|
-
let documentImportName;
|
90
|
-
let localDefaultExportId;
|
91
|
-
let exportDeclarationType;
|
92
|
-
return {
|
93
|
-
ExportDefaultDeclaration: (node) => {
|
94
|
-
exportDeclarationType = node.declaration.type;
|
95
|
-
if (node.declaration.type === "FunctionDeclaration") {
|
96
|
-
localDefaultExportId = node.declaration.id;
|
97
|
-
return;
|
98
|
-
}
|
99
|
-
if (node.declaration.type === "ClassDeclaration" && node.declaration.superClass && "name" in node.declaration.superClass && node.declaration.superClass.name === documentImportName) {
|
100
|
-
localDefaultExportId = node.declaration.id;
|
101
|
-
}
|
102
|
-
},
|
103
|
-
ImportDeclaration: (node) => {
|
104
|
-
if (node.source.value === "next/document") {
|
105
|
-
const documentImport = node.specifiers.find(
|
106
|
-
({ type }) => type === "ImportDefaultSpecifier"
|
107
|
-
);
|
108
|
-
if (documentImport?.local) {
|
109
|
-
documentImportName = documentImport.local.name;
|
110
|
-
}
|
111
|
-
}
|
112
|
-
},
|
113
|
-
JSXOpeningElement: (node) => {
|
114
|
-
if (node.name.name !== "link") {
|
115
|
-
return;
|
116
|
-
}
|
117
|
-
const ancestors = sourceCode.getAncestors(node);
|
118
|
-
if (!localDefaultExportId) {
|
119
|
-
const program = ancestors.find(
|
120
|
-
(ancestor) => ancestor.type === "Program"
|
121
|
-
);
|
122
|
-
for (let i = 0; i <= program.tokens.length - 1; i++) {
|
123
|
-
if (localDefaultExportId) {
|
124
|
-
break;
|
125
|
-
}
|
126
|
-
const token = program.tokens[i];
|
127
|
-
if (token?.type === "Keyword" && token.value === "export") {
|
128
|
-
const nextToken = program.tokens[i + 1];
|
129
|
-
if (nextToken && nextToken.type === "Keyword" && nextToken.value === "default") {
|
130
|
-
const maybeIdentifier = program.tokens[i + 2];
|
131
|
-
if (maybeIdentifier && maybeIdentifier.type === "Identifier") {
|
132
|
-
localDefaultExportId = { name: maybeIdentifier.value };
|
133
|
-
}
|
134
|
-
}
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
const parentComponent = ancestors.find((ancestor) => {
|
139
|
-
if (exportDeclarationType === "ClassDeclaration") {
|
140
|
-
return ancestor.type === exportDeclarationType && "superClass" in ancestor && ancestor.superClass && "name" in ancestor.superClass && ancestor.superClass.name === documentImportName;
|
141
|
-
}
|
142
|
-
if ("id" in ancestor) {
|
143
|
-
if (exportDeclarationType === "FunctionDeclaration") {
|
144
|
-
return ancestor.type === exportDeclarationType && isIdentifierMatch(ancestor.id, localDefaultExportId);
|
145
|
-
}
|
146
|
-
return isIdentifierMatch(ancestor.id, localDefaultExportId);
|
147
|
-
}
|
148
|
-
return false;
|
149
|
-
});
|
150
|
-
if (isDocument && parentComponent) {
|
151
|
-
return;
|
152
|
-
}
|
153
|
-
const attributes = new NodeAttributes(node);
|
154
|
-
if (!attributes.has("href") || !attributes.hasValue("href")) {
|
155
|
-
return;
|
156
|
-
}
|
157
|
-
const hrefValue = attributes.value("href");
|
158
|
-
const isGoogleFont = typeof hrefValue === "string" && hrefValue.startsWith("https://fonts.googleapis.com/css");
|
159
|
-
if (isGoogleFont) {
|
160
|
-
const end = `This is discouraged. See: ${url}`;
|
161
|
-
const message = isDocument ? `Using \`<link />\` outside of \`<Head>\` will disable automatic font optimization. ${end}` : `Custom fonts not added in \`pages/_document.js\` will only load for a single page. ${end}`;
|
162
|
-
context.report({
|
163
|
-
message,
|
164
|
-
node
|
165
|
-
});
|
166
|
-
}
|
167
|
-
}
|
168
|
-
};
|
169
|
-
},
|
170
|
-
meta: {
|
171
|
-
docs: {
|
172
|
-
description: "Prevent page-only custom fonts.",
|
173
|
-
recommended: true,
|
174
|
-
url
|
175
|
-
},
|
176
|
-
schema: [],
|
177
|
-
type: "problem"
|
178
|
-
}
|
179
|
-
});
|
180
|
-
// Annotate the CommonJS export names for ESM import in node:
|
181
|
-
0 && (module.exports = {
|
182
|
-
noPageCustomFont
|
183
|
-
});
|
184
|
-
//# sourceMappingURL=no-page-custom-font.cjs.map
|