Adds eslint-plugin-eslint-plugin
to ensure eslint-plugin-next
rules follow ESLint rule best practices along with enforcing some consistency. (#37920)
* Adds eslint-plugin-eslint-plugin and recommended rules. * Removes `fixable` as none of the rules contain fixers. * Adds description and url rules. * Adds message format. * Removes optional dependencies. * Lints eslint-plugin-next tests too. * Removes optional dependencies from pnpm lock file. * Resets pnpm lock file. * Resets package.json too. * Fixes pnpm lockfile.
This commit is contained in:
parent
160da6b806
commit
ab48f54786
23 changed files with 78 additions and 12 deletions
|
@ -145,6 +145,30 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"packages/eslint-plugin-next/**/*.js",
|
||||
"test/unit/eslint-plugin-next/**/*.test.ts"
|
||||
],
|
||||
"extends": ["plugin:eslint-plugin/recommended"],
|
||||
"parserOptions": {
|
||||
"sourceType": "script"
|
||||
},
|
||||
"rules": {
|
||||
"eslint-plugin/prefer-replace-text": "error",
|
||||
"eslint-plugin/report-message-format": [
|
||||
"error",
|
||||
".+\\. See: https://nextjs.org/docs/messages/[a-z\\-]+$"
|
||||
],
|
||||
"eslint-plugin/require-meta-docs-description": [
|
||||
"error",
|
||||
{
|
||||
"pattern": ".+"
|
||||
}
|
||||
],
|
||||
"eslint-plugin/require-meta-docs-url": "error"
|
||||
}
|
||||
}
|
||||
],
|
||||
"rules": {
|
||||
|
|
|
@ -126,6 +126,7 @@
|
|||
"escape-string-regexp": "2.0.0",
|
||||
"eslint": "7.24.0",
|
||||
"eslint-config-next": "workspace:*",
|
||||
"eslint-plugin-eslint-plugin": "4.3.0",
|
||||
"eslint-plugin-import": "2.22.1",
|
||||
"eslint-plugin-jest": "24.3.5",
|
||||
"eslint-plugin-react": "7.23.2",
|
||||
|
|
|
@ -9,6 +9,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
|
|
|
@ -9,6 +9,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
|
|
|
@ -8,6 +8,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
let nextScriptImportName = null
|
||||
|
|
|
@ -25,8 +25,9 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
schema: [],
|
||||
create: function (context) {
|
||||
return {
|
||||
JSXOpeningElement(node) {
|
||||
|
|
|
@ -7,6 +7,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
|
|
|
@ -11,6 +11,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
let scriptImportName = null
|
||||
|
|
|
@ -7,8 +7,9 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
schema: [],
|
||||
create: function (context) {
|
||||
return {
|
||||
JSXOpeningElement(node) {
|
||||
|
|
|
@ -10,6 +10,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
|
|
|
@ -8,6 +8,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
let documentImportName
|
||||
|
|
|
@ -8,7 +8,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
fixable: 'code',
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
|
|
|
@ -9,6 +9,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
fixable: null, // or "code" or "whitespace"
|
||||
type: 'problem',
|
||||
schema: [
|
||||
{
|
||||
oneOf: [
|
||||
|
|
|
@ -8,7 +8,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
fixable: 'code',
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
|
|
|
@ -10,6 +10,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
const paths = context.getFilename().split('pages')
|
||||
|
|
|
@ -8,6 +8,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
let isNextHead = null
|
||||
|
|
|
@ -9,7 +9,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
fixable: 'code',
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
return {
|
||||
|
@ -44,5 +45,3 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
}
|
||||
|
||||
module.exports.schema = []
|
||||
|
|
|
@ -7,8 +7,9 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
schema: [],
|
||||
create: function (context) {
|
||||
return {
|
||||
JSXOpeningElement(node) {
|
||||
|
|
|
@ -8,6 +8,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
create: function (context) {
|
||||
let headFromNextDocument = false
|
||||
|
|
|
@ -39,14 +39,15 @@ function minDistance(a, b) {
|
|||
return previousRow[previousRow.length - 1]
|
||||
}
|
||||
|
||||
/* eslint-disable eslint-plugin/require-meta-docs-url */
|
||||
module.exports = {
|
||||
meta: {
|
||||
docs: {
|
||||
description: 'Prevent common typos in Next.js data fetching functions.',
|
||||
category: 'Stylistic Issues',
|
||||
recommended: true,
|
||||
},
|
||||
fixable: null,
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
|
|
|
@ -72,7 +72,8 @@ module.exports = {
|
|||
recommended: true,
|
||||
url,
|
||||
},
|
||||
fixable: null,
|
||||
type: 'problem',
|
||||
schema: [],
|
||||
},
|
||||
|
||||
create: function (context) {
|
||||
|
|
|
@ -89,6 +89,7 @@ importers:
|
|||
escape-string-regexp: 2.0.0
|
||||
eslint: 7.24.0
|
||||
eslint-config-next: workspace:*
|
||||
eslint-plugin-eslint-plugin: 4.3.0
|
||||
eslint-plugin-import: 2.22.1
|
||||
eslint-plugin-jest: 24.3.5
|
||||
eslint-plugin-react: 7.23.2
|
||||
|
@ -243,6 +244,7 @@ importers:
|
|||
escape-string-regexp: 2.0.0
|
||||
eslint: 7.24.0
|
||||
eslint-config-next: link:packages/eslint-config-next
|
||||
eslint-plugin-eslint-plugin: 4.3.0_eslint@7.24.0
|
||||
eslint-plugin-import: 2.22.1_23iivq3ybsthf4qrv3kgatrvhe
|
||||
eslint-plugin-jest: 24.3.5_lqson4bxnnkvr5juyhnlzmz4rq
|
||||
eslint-plugin-react: 7.23.2_eslint@7.24.0
|
||||
|
@ -10326,6 +10328,17 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-eslint-plugin/4.3.0_eslint@7.24.0:
|
||||
resolution: {integrity: sha512-0xZ++ilIpGY+gBwsaW/uIhG/Rrl/sltPCai3UUPzWbaOPud2tel9UCWj8sLTADNmVqBD+vcqLHzHY86q/b71yg==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
peerDependencies:
|
||||
eslint: '>=6.0.0'
|
||||
dependencies:
|
||||
eslint: 7.24.0
|
||||
eslint-utils: 3.0.0_eslint@7.24.0
|
||||
estraverse: 5.3.0
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.22.1_23iivq3ybsthf4qrv3kgatrvhe:
|
||||
resolution: {integrity: sha512-8K7JjINHOpH64ozkAhpT3sd+FswIZTfMZTjdx052pnWrgRCVfp8op9tbjpAk3DdUeI/Ba4C8OjdC0r90erHEOw==}
|
||||
engines: {node: '>=4'}
|
||||
|
|
Loading…
Reference in a new issue