Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports = {
if (message) {
context.report({
node,
message: `${message} See https://nextjs.org/docs/messages/google-font-display.`,
message: `${message} See: https://nextjs.org/docs/messages/google-font-display`,
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = {
) {
context.report({
node,
message: `Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.`,
message: `Preconnect is missing. See: https://nextjs.org/docs/messages/google-font-preconnect`,
})
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/lib/rules/link-passhref.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = {
attributes.value('passHref') !== true
? 'must be set to true'
: 'is missing'
}. See https://nextjs.org/docs/messages/link-passhref`,
}. See: https://nextjs.org/docs/messages/link-passhref`,
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const SUPPORTED_HTML_CONTENT_URLS = [
'www.googletagmanager.com/gtm.js',
]
const ERROR_MSG =
'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga.'
'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga'

// Check if one of the items in the list is a substring of the passed string
const containsStr = (str, strList) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/lib/rules/no-css-tags.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function (context) {
context.report({
node,
message:
'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags.',
'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags',
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {

context.report({
node,
message: `next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.`,
message: `next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page`,
})
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = {
) {
context.report({
node,
message: `next/head should not be imported in pages${document}. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.`,
message: `next/head should not be imported in pages${document}. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document`,
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ module.exports = {
if (url.test(normalizeURL(hrefPath))) {
context.report({
node,
message: `Do not use the HTML <a> tag to navigate to ${hrefPath}. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages.`,
message: `Do not use the HTML <a> tag to navigate to ${hrefPath}. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages`,
})
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/lib/rules/no-img-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {

context.report({
node,
message: `Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element.`,
message: `Do not use <img>. Use Image from 'next/image' instead. See: https://nextjs.org/docs/messages/no-img-element`,
})
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ module.exports = {

if (isGoogleFont) {
const end =
'This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.'
'This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font'

const message = is_Document
? `Rendering this <link /> not inline within <Head> of Document disables font optimization. ${end}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = {

context.report({
node,
message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page `,
message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page`,
})
},
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/lib/rules/no-script-in-head.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
context.report({
node,
message:
"next/script shouldn't be used inside next/head. See: https://nextjs.org/docs/messages/no-script-in-head-component ",
"next/script shouldn't be used inside next/head. See: https://nextjs.org/docs/messages/no-script-in-head-component",
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {

context.report({
node,
message: `next/server should not be imported outside of pages/_middleware.js. See https://nextjs.org/docs/messages/no-server-import-in-page.`,
message: `next/server should not be imported outside of pages/_middleware.js. See: https://nextjs.org/docs/messages/no-server-import-in-page`,
})
},
}
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-plugin-next/lib/rules/no-sync-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function (context) {
context.report({
node,
message:
'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts.',
'External synchronous scripts are forbidden. See: https://nextjs.org/docs/messages/no-sync-scripts',
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
context.report({
node: titleTag,
message:
'Titles should be defined at the page-level using next/head. See https://nextjs.org/docs/messages/no-title-in-document-head.',
'Titles should be defined at the page-level using next/head. See: https://nextjs.org/docs/messages/no-title-in-document-head',
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ module.exports = {
', '
)} ${
unwantedFeatures.length > 1 ? 'are' : 'is'
} already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio.`,
} already shipped with Next.js. See: https://nextjs.org/docs/messages/no-unwanted-polyfillio`,
})
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/unit/eslint-plugin-next/google-font-display.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ruleTester.run('google-font-display', rule, {
errors: [
{
message:
'Display parameter is missing. See https://nextjs.org/docs/messages/google-font-display.',
'Display parameter is missing. See: https://nextjs.org/docs/messages/google-font-display',
type: 'JSXOpeningElement',
},
],
Expand All @@ -98,7 +98,7 @@ ruleTester.run('google-font-display', rule, {
errors: [
{
message:
'Block behavior is not recommended. See https://nextjs.org/docs/messages/google-font-display.',
'Block behavior is not recommended. See: https://nextjs.org/docs/messages/google-font-display',
type: 'JSXOpeningElement',
},
],
Expand All @@ -120,7 +120,7 @@ ruleTester.run('google-font-display', rule, {
errors: [
{
message:
'Auto behavior is not recommended. See https://nextjs.org/docs/messages/google-font-display.',
'Auto behavior is not recommended. See: https://nextjs.org/docs/messages/google-font-display',
type: 'JSXOpeningElement',
},
],
Expand All @@ -142,7 +142,7 @@ ruleTester.run('google-font-display', rule, {
errors: [
{
message:
'Fallback behavior is not recommended. See https://nextjs.org/docs/messages/google-font-display.',
'Fallback behavior is not recommended. See: https://nextjs.org/docs/messages/google-font-display',
type: 'JSXOpeningElement',
},
],
Expand Down
4 changes: 2 additions & 2 deletions test/unit/eslint-plugin-next/google-font-preconnect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ ruleTester.run('google-font-preconnect', rule, {
errors: [
{
message:
'Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.',
'Preconnect is missing. See: https://nextjs.org/docs/messages/google-font-preconnect',
type: 'JSXOpeningElement',
},
],
Expand All @@ -58,7 +58,7 @@ ruleTester.run('google-font-preconnect', rule, {
errors: [
{
message:
'Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.',
'Preconnect is missing. See: https://nextjs.org/docs/messages/google-font-preconnect',
type: 'JSXOpeningElement',
},
],
Expand Down
4 changes: 2 additions & 2 deletions test/unit/eslint-plugin-next/link-passhref.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ ruleTester.run('link-passhref', rule, {
errors: [
{
message:
'passHref is missing. See https://nextjs.org/docs/messages/link-passhref',
'passHref is missing. See: https://nextjs.org/docs/messages/link-passhref',
type: 'JSXOpeningElement',
},
],
Expand All @@ -69,7 +69,7 @@ ruleTester.run('link-passhref', rule, {
errors: [
{
message:
'passHref must be set to true. See https://nextjs.org/docs/messages/link-passhref',
'passHref must be set to true. See: https://nextjs.org/docs/messages/link-passhref',
type: 'JSXOpeningElement',
},
],
Expand Down
2 changes: 1 addition & 1 deletion test/unit/eslint-plugin-next/next-script-for-ga.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { RuleTester } from 'eslint'
})

const ERROR_MSG =
'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga.'
'Use the `next/script` component for loading third party scripts. See: https://nextjs.org/docs/messages/next-script-for-ga'

const ruleTester = new RuleTester()

Expand Down
4 changes: 2 additions & 2 deletions test/unit/eslint-plugin-next/no-css-tags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ruleTester.run('no-css-tags', rule, {
errors: [
{
message:
'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags.',
'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags',
type: 'JSXOpeningElement',
},
],
Expand All @@ -94,7 +94,7 @@ ruleTester.run('no-css-tags', rule, {
errors: [
{
message:
'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags.',
'Do not include stylesheets manually. See: https://nextjs.org/docs/messages/no-css-tags',
type: 'JSXOpeningElement',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ruleTester.run('no-document-import-in-page', rule, {
errors: [
{
message:
'next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.',
'next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page',
type: 'ImportDeclaration',
},
],
Expand All @@ -139,7 +139,7 @@ ruleTester.run('no-document-import-in-page', rule, {
errors: [
{
message:
'next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.',
'next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page',
type: 'ImportDeclaration',
},
],
Expand All @@ -153,7 +153,7 @@ ruleTester.run('no-document-import-in-page', rule, {
errors: [
{
message:
'next/document should not be imported outside of pages/_document.js. See https://nextjs.org/docs/messages/no-document-import-in-page.',
'next/document should not be imported outside of pages/_document.js. See: https://nextjs.org/docs/messages/no-document-import-in-page',
type: 'ImportDeclaration',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ ruleTester.run('no-head-import-in-document', rule, {
errors: [
{
message:
'next/head should not be imported in pages/_document.js. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.',
'next/head should not be imported in pages/_document.js. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document',
type: 'ImportDeclaration',
},
],
Expand Down Expand Up @@ -107,7 +107,7 @@ ruleTester.run('no-head-import-in-document', rule, {
errors: [
{
message:
'next/head should not be imported in pages/_document.page.tsx. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.',
'next/head should not be imported in pages/_document.page.tsx. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document',
type: 'ImportDeclaration',
},
],
Expand Down Expand Up @@ -137,7 +137,7 @@ ruleTester.run('no-head-import-in-document', rule, {
errors: [
{
message:
'next/head should not be imported in pages/_document/index.js. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.',
'next/head should not be imported in pages/_document/index.js. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document',
type: 'ImportDeclaration',
},
],
Expand Down Expand Up @@ -167,7 +167,7 @@ ruleTester.run('no-head-import-in-document', rule, {
errors: [
{
message:
'next/head should not be imported in pages/_document/index.tsx. Import Head from next/document instead. See https://nextjs.org/docs/messages/no-head-import-in-document.',
'next/head should not be imported in pages/_document/index.tsx. Import Head from next/document instead. See: https://nextjs.org/docs/messages/no-head-import-in-document',
type: 'ImportDeclaration',
},
],
Expand Down
8 changes: 4 additions & 4 deletions test/unit/eslint-plugin-next/no-html-link-for-pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ describe('no-html-link-for-pages', function () {
assert.notEqual(report, undefined, 'No lint errors found.')
assert.equal(
report.message,
"Do not use the HTML <a> tag to navigate to /. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages."
"Do not use the HTML <a> tag to navigate to /. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages"
)
})

Expand All @@ -257,7 +257,7 @@ describe('no-html-link-for-pages', function () {
assert.notEqual(report, undefined, 'No lint errors found.')
assert.equal(
report.message,
"Do not use the HTML <a> tag to navigate to /list/foo/bar/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages."
"Do not use the HTML <a> tag to navigate to /list/foo/bar/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages"
)
const [secondReport] = linter.verify(
secondInvalidDynamicCode,
Expand All @@ -269,15 +269,15 @@ describe('no-html-link-for-pages', function () {
assert.notEqual(secondReport, undefined, 'No lint errors found.')
assert.equal(
secondReport.message,
"Do not use the HTML <a> tag to navigate to /list/foo/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages."
"Do not use the HTML <a> tag to navigate to /list/foo/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages"
)
const [thirdReport] = linter.verify(thirdInvalidDynamicCode, linterConfig, {
filename: 'foo.js',
})
assert.notEqual(thirdReport, undefined, 'No lint errors found.')
assert.equal(
thirdReport.message,
"Do not use the HTML <a> tag to navigate to /list/lorem-ipsum/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages."
"Do not use the HTML <a> tag to navigate to /list/lorem-ipsum/. Use Link from 'next/link' instead. See: https://nextjs.org/docs/messages/no-html-link-for-pages"
)
})
})
2 changes: 1 addition & 1 deletion test/unit/eslint-plugin-next/no-img-element.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ruleTester.run('no-img-element', rule, {
errors: [
{
message:
"Do not use <img>. Use Image from 'next/image' instead. See https://nextjs.org/docs/messages/no-img-element.",
"Do not use <img>. Use Image from 'next/image' instead. See: https://nextjs.org/docs/messages/no-img-element",
type: 'JSXOpeningElement',
},
],
Expand Down
6 changes: 3 additions & 3 deletions test/unit/eslint-plugin-next/no-page-custom-font.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ruleTester.run('no-page-custom-font', rule, {
errors: [
{
message:
'Custom fonts not added at the document level will only load for a single page. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.',
'Custom fonts not added at the document level will only load for a single page. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font',
type: 'JSXOpeningElement',
},
],
Expand Down Expand Up @@ -188,11 +188,11 @@ ruleTester.run('no-page-custom-font', rule, {
errors: [
{
message:
'Rendering this <link /> not inline within <Head> of Document disables font optimization. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.',
'Rendering this <link /> not inline within <Head> of Document disables font optimization. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font',
},
{
message:
'Rendering this <link /> not inline within <Head> of Document disables font optimization. This is discouraged. See https://nextjs.org/docs/messages/no-page-custom-font.',
'Rendering this <link /> not inline within <Head> of Document disables font optimization. This is discouraged. See: https://nextjs.org/docs/messages/no-page-custom-font',
},
],
},
Expand Down
4 changes: 2 additions & 2 deletions test/unit/eslint-plugin-next/no-script-in-document.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ruleTester.run('no-script-import-in-document', rule, {
filename: 'pages/_document.js',
errors: [
{
message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page `,
message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page`,
},
],
},
Expand Down Expand Up @@ -107,7 +107,7 @@ ruleTester.run('no-script-import-in-document', rule, {
filename: 'pages/_document.js',
errors: [
{
message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page `,
message: `next/script should not be used in pages/_document.js. See: https://nextjs.org/docs/messages/no-script-in-document-page`,
},
],
},
Expand Down
Loading