@w5s/eslint-config 3.6.0 → 3.7.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/dist/index.d.ts +639 -14
- package/dist/index.js +137 -84
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/config/e18e.ts +71 -0
- package/src/config/es.ts +10 -3
- package/src/config/imports.ts +21 -11
- package/src/config/jsdoc.ts +20 -9
- package/src/config/jsonc.ts +7 -2
- package/src/config/markdown.ts +8 -2
- package/src/config/next.ts +50 -0
- package/src/config/node.ts +18 -13
- package/src/config/test.ts +10 -3
- package/src/config/unicorn.ts +2 -3
- package/src/config/yml.ts +8 -6
- package/src/config.ts +2 -0
- package/src/defineConfig.ts +22 -45
- package/src/type/PluginOptionsBase.ts +5 -0
- package/src/typegen/e18e.d.ts +123 -0
- package/src/typegen/next.d.ts +120 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
import type { Linter } from 'eslint'
|
|
4
|
+
|
|
5
|
+
declare module 'eslint' {
|
|
6
|
+
namespace Linter {
|
|
7
|
+
interface RulesRecord extends RuleOptions {}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RuleOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Disallow dependencies in favor of more performant or secure alternatives
|
|
14
|
+
*/
|
|
15
|
+
'e18e/ban-dependencies'?: Linter.RuleEntry<E18EBanDependencies>
|
|
16
|
+
/**
|
|
17
|
+
* Disallow `delete` on properties — V8 deoptimizes the object to dictionary mode
|
|
18
|
+
*/
|
|
19
|
+
'e18e/no-delete-property'?: Linter.RuleEntry<[]>
|
|
20
|
+
/**
|
|
21
|
+
* Prefer optimized alternatives to `indexOf()` equality checks
|
|
22
|
+
*/
|
|
23
|
+
'e18e/no-indexof-equality'?: Linter.RuleEntry<[]>
|
|
24
|
+
/**
|
|
25
|
+
* Disallow spreading the accumulator inside a `reduce` callback (O(N²) growth)
|
|
26
|
+
*/
|
|
27
|
+
'e18e/no-spread-in-reduce'?: Linter.RuleEntry<[]>
|
|
28
|
+
/**
|
|
29
|
+
* Prefer Array.prototype.at() over length-based indexing
|
|
30
|
+
*/
|
|
31
|
+
'e18e/prefer-array-at'?: Linter.RuleEntry<[]>
|
|
32
|
+
/**
|
|
33
|
+
* Prefer Array.prototype.fill() over Array.from or map with constant values
|
|
34
|
+
*/
|
|
35
|
+
'e18e/prefer-array-fill'?: Linter.RuleEntry<[]>
|
|
36
|
+
/**
|
|
37
|
+
* Prefer Array.from(iterable, mapper) over [...iterable].map(mapper) to avoid intermediate array allocation
|
|
38
|
+
*/
|
|
39
|
+
'e18e/prefer-array-from-map'?: Linter.RuleEntry<[]>
|
|
40
|
+
/**
|
|
41
|
+
* Prefer Array.some() over Array.find() and Array.filter().length checks when checking for element existence
|
|
42
|
+
*/
|
|
43
|
+
'e18e/prefer-array-some'?: Linter.RuleEntry<[]>
|
|
44
|
+
/**
|
|
45
|
+
* Prefer Array.prototype.toReversed() over copying and reversing arrays
|
|
46
|
+
*/
|
|
47
|
+
'e18e/prefer-array-to-reversed'?: Linter.RuleEntry<[]>
|
|
48
|
+
/**
|
|
49
|
+
* Prefer Array.prototype.toSorted() over copying and sorting arrays
|
|
50
|
+
*/
|
|
51
|
+
'e18e/prefer-array-to-sorted'?: Linter.RuleEntry<[]>
|
|
52
|
+
/**
|
|
53
|
+
* Prefer Array.prototype.toSpliced() over copying and splicing arrays
|
|
54
|
+
*/
|
|
55
|
+
'e18e/prefer-array-to-spliced'?: Linter.RuleEntry<[]>
|
|
56
|
+
/**
|
|
57
|
+
* Prefer Date.now() over new Date().getTime() and +new Date()
|
|
58
|
+
*/
|
|
59
|
+
'e18e/prefer-date-now'?: Linter.RuleEntry<[]>
|
|
60
|
+
/**
|
|
61
|
+
* Prefer the exponentiation operator ** over Math.pow()
|
|
62
|
+
*/
|
|
63
|
+
'e18e/prefer-exponentiation-operator'?: Linter.RuleEntry<[]>
|
|
64
|
+
/**
|
|
65
|
+
* Prefer .includes() over indexOf() comparisons for arrays and strings
|
|
66
|
+
*/
|
|
67
|
+
'e18e/prefer-includes'?: Linter.RuleEntry<[]>
|
|
68
|
+
/**
|
|
69
|
+
* Prefer String.prototype.{includes,startsWith,endsWith} over equivalent regex.test() calls
|
|
70
|
+
*/
|
|
71
|
+
'e18e/prefer-includes-over-regex-test'?: Linter.RuleEntry<[]>
|
|
72
|
+
/**
|
|
73
|
+
* Prefer inline equality checks over temporary object creation for simple comparisons
|
|
74
|
+
*/
|
|
75
|
+
'e18e/prefer-inline-equality'?: Linter.RuleEntry<[]>
|
|
76
|
+
/**
|
|
77
|
+
* Prefer nullish coalescing operator (?? and ??=) over verbose null checks
|
|
78
|
+
*/
|
|
79
|
+
'e18e/prefer-nullish-coalescing'?: Linter.RuleEntry<[]>
|
|
80
|
+
/**
|
|
81
|
+
* Prefer Object.hasOwn() over Object.prototype.hasOwnProperty.call() and obj.hasOwnProperty()
|
|
82
|
+
*/
|
|
83
|
+
'e18e/prefer-object-has-own'?: Linter.RuleEntry<[]>
|
|
84
|
+
/**
|
|
85
|
+
* prefer `RegExp.test()` over `String.match()` and `RegExp.exec()` when only checking for match existence
|
|
86
|
+
*/
|
|
87
|
+
'e18e/prefer-regex-test'?: Linter.RuleEntry<[]>
|
|
88
|
+
/**
|
|
89
|
+
* Prefer spread syntax over Array.concat(), Array.from(), Object.assign({}, ...), and Function.apply()
|
|
90
|
+
*/
|
|
91
|
+
'e18e/prefer-spread-syntax'?: Linter.RuleEntry<[]>
|
|
92
|
+
/**
|
|
93
|
+
* Prefer hoisting an `Intl.Collator` instance over calling localeCompare in a sort callback
|
|
94
|
+
*/
|
|
95
|
+
'e18e/prefer-static-collator'?: Linter.RuleEntry<[]>
|
|
96
|
+
/**
|
|
97
|
+
* Prefer defining regular expressions at module scope to avoid re-compilation on every function call
|
|
98
|
+
*/
|
|
99
|
+
'e18e/prefer-static-regex'?: Linter.RuleEntry<[]>
|
|
100
|
+
/**
|
|
101
|
+
* Prefer String.fromCharCode() over String.fromCodePoint() for code points below 0x10000
|
|
102
|
+
*/
|
|
103
|
+
'e18e/prefer-string-fromcharcode'?: Linter.RuleEntry<[]>
|
|
104
|
+
/**
|
|
105
|
+
* Prefer passing function and arguments directly to setTimeout/setInterval instead of wrapping in an arrow function or using bind
|
|
106
|
+
*/
|
|
107
|
+
'e18e/prefer-timer-args'?: Linter.RuleEntry<[]>
|
|
108
|
+
/**
|
|
109
|
+
* Prefer URL.canParse() over try-catch blocks for URL validation
|
|
110
|
+
*/
|
|
111
|
+
'e18e/prefer-url-canparse'?: Linter.RuleEntry<[]>
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* ======= Declarations ======= */
|
|
115
|
+
// ----- e18e/ban-dependencies -----
|
|
116
|
+
type E18EBanDependencies = []|[{
|
|
117
|
+
|
|
118
|
+
presets?: string[]
|
|
119
|
+
|
|
120
|
+
modules?: string[]
|
|
121
|
+
|
|
122
|
+
allowed?: string[]
|
|
123
|
+
}]
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
import type { Linter } from 'eslint'
|
|
4
|
+
|
|
5
|
+
declare module 'eslint' {
|
|
6
|
+
namespace Linter {
|
|
7
|
+
interface RulesRecord extends RuleOptions {}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface RuleOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Enforce font-display behavior with Google Fonts.
|
|
14
|
+
* @see https://nextjs.org/docs/messages/google-font-display
|
|
15
|
+
*/
|
|
16
|
+
'next/google-font-display'?: Linter.RuleEntry<[]>
|
|
17
|
+
/**
|
|
18
|
+
* Ensure `preconnect` is used with Google Fonts.
|
|
19
|
+
* @see https://nextjs.org/docs/messages/google-font-preconnect
|
|
20
|
+
*/
|
|
21
|
+
'next/google-font-preconnect'?: Linter.RuleEntry<[]>
|
|
22
|
+
/**
|
|
23
|
+
* Enforce `id` attribute on `next/script` components with inline content.
|
|
24
|
+
* @see https://nextjs.org/docs/messages/inline-script-id
|
|
25
|
+
*/
|
|
26
|
+
'next/inline-script-id'?: Linter.RuleEntry<[]>
|
|
27
|
+
/**
|
|
28
|
+
* Prefer `@next/third-parties/google` when using the inline script for Google Analytics and Tag Manager.
|
|
29
|
+
* @see https://nextjs.org/docs/messages/next-script-for-ga
|
|
30
|
+
*/
|
|
31
|
+
'next/next-script-for-ga'?: Linter.RuleEntry<[]>
|
|
32
|
+
/**
|
|
33
|
+
* Prevent assignment to the `module` variable.
|
|
34
|
+
* @see https://nextjs.org/docs/messages/no-assign-module-variable
|
|
35
|
+
*/
|
|
36
|
+
'next/no-assign-module-variable'?: Linter.RuleEntry<[]>
|
|
37
|
+
/**
|
|
38
|
+
* Prevent Client Components from being async functions.
|
|
39
|
+
* @see https://nextjs.org/docs/messages/no-async-client-component
|
|
40
|
+
*/
|
|
41
|
+
'next/no-async-client-component'?: Linter.RuleEntry<[]>
|
|
42
|
+
/**
|
|
43
|
+
* Prevent usage of `next/script`'s `beforeInteractive` strategy outside of `pages/_document.js`.
|
|
44
|
+
* @see https://nextjs.org/docs/messages/no-before-interactive-script-outside-document
|
|
45
|
+
*/
|
|
46
|
+
'next/no-before-interactive-script-outside-document'?: Linter.RuleEntry<[]>
|
|
47
|
+
/**
|
|
48
|
+
* Prevent manual stylesheet tags.
|
|
49
|
+
* @see https://nextjs.org/docs/messages/no-css-tags
|
|
50
|
+
*/
|
|
51
|
+
'next/no-css-tags'?: Linter.RuleEntry<[]>
|
|
52
|
+
/**
|
|
53
|
+
* Prevent importing `next/document` outside of `pages/_document.js`.
|
|
54
|
+
* @see https://nextjs.org/docs/messages/no-document-import-in-page
|
|
55
|
+
*/
|
|
56
|
+
'next/no-document-import-in-page'?: Linter.RuleEntry<[]>
|
|
57
|
+
/**
|
|
58
|
+
* Prevent duplicate usage of `<Head>` in `pages/_document.js`.
|
|
59
|
+
* @see https://nextjs.org/docs/messages/no-duplicate-head
|
|
60
|
+
*/
|
|
61
|
+
'next/no-duplicate-head'?: Linter.RuleEntry<[]>
|
|
62
|
+
/**
|
|
63
|
+
* Prevent usage of `<head>` element.
|
|
64
|
+
* @see https://nextjs.org/docs/messages/no-head-element
|
|
65
|
+
*/
|
|
66
|
+
'next/no-head-element'?: Linter.RuleEntry<[]>
|
|
67
|
+
/**
|
|
68
|
+
* Prevent usage of `next/head` in `pages/_document.js`.
|
|
69
|
+
* @see https://nextjs.org/docs/messages/no-head-import-in-document
|
|
70
|
+
*/
|
|
71
|
+
'next/no-head-import-in-document'?: Linter.RuleEntry<[]>
|
|
72
|
+
/**
|
|
73
|
+
* Prevent usage of `<a>` elements to navigate to internal Next.js pages.
|
|
74
|
+
* @see https://nextjs.org/docs/messages/no-html-link-for-pages
|
|
75
|
+
*/
|
|
76
|
+
'next/no-html-link-for-pages'?: Linter.RuleEntry<NextNoHtmlLinkForPages>
|
|
77
|
+
/**
|
|
78
|
+
* Prevent usage of `<img>` element due to slower LCP and higher bandwidth.
|
|
79
|
+
* @see https://nextjs.org/docs/messages/no-img-element
|
|
80
|
+
*/
|
|
81
|
+
'next/no-img-element'?: Linter.RuleEntry<[]>
|
|
82
|
+
/**
|
|
83
|
+
* Prevent page-only custom fonts.
|
|
84
|
+
* @see https://nextjs.org/docs/messages/no-page-custom-font
|
|
85
|
+
*/
|
|
86
|
+
'next/no-page-custom-font'?: Linter.RuleEntry<[]>
|
|
87
|
+
/**
|
|
88
|
+
* Prevent usage of `next/script` in `next/head` component.
|
|
89
|
+
* @see https://nextjs.org/docs/messages/no-script-component-in-head
|
|
90
|
+
*/
|
|
91
|
+
'next/no-script-component-in-head'?: Linter.RuleEntry<[]>
|
|
92
|
+
/**
|
|
93
|
+
* Prevent usage of `styled-jsx` in `pages/_document.js`.
|
|
94
|
+
* @see https://nextjs.org/docs/messages/no-styled-jsx-in-document
|
|
95
|
+
*/
|
|
96
|
+
'next/no-styled-jsx-in-document'?: Linter.RuleEntry<[]>
|
|
97
|
+
/**
|
|
98
|
+
* Prevent synchronous scripts.
|
|
99
|
+
* @see https://nextjs.org/docs/messages/no-sync-scripts
|
|
100
|
+
*/
|
|
101
|
+
'next/no-sync-scripts'?: Linter.RuleEntry<[]>
|
|
102
|
+
/**
|
|
103
|
+
* Prevent usage of `<title>` with `Head` component from `next/document`.
|
|
104
|
+
* @see https://nextjs.org/docs/messages/no-title-in-document-head
|
|
105
|
+
*/
|
|
106
|
+
'next/no-title-in-document-head'?: Linter.RuleEntry<[]>
|
|
107
|
+
/**
|
|
108
|
+
* Prevent common typos in Next.js data fetching functions.
|
|
109
|
+
*/
|
|
110
|
+
'next/no-typos'?: Linter.RuleEntry<[]>
|
|
111
|
+
/**
|
|
112
|
+
* Prevent duplicate polyfills from Polyfill.io.
|
|
113
|
+
* @see https://nextjs.org/docs/messages/no-unwanted-polyfillio
|
|
114
|
+
*/
|
|
115
|
+
'next/no-unwanted-polyfillio'?: Linter.RuleEntry<[]>
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* ======= Declarations ======= */
|
|
119
|
+
// ----- next/no-html-link-for-pages -----
|
|
120
|
+
type NextNoHtmlLinkForPages = []|[(string | string[])]
|