eslint-config-next 16.0.0-canary.5 → 16.0.0-canary.6

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.
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var _eslintpluginnext = /*#__PURE__*/ _interop_require_default(require("@next/eslint-plugin-next"));
3
+ var _index = /*#__PURE__*/ _interop_require_default(require("./index"));
4
+ function _array_like_to_array(arr, len) {
5
+ if (len == null || len > arr.length) len = arr.length;
6
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
7
+ return arr2;
8
+ }
9
+ function _array_without_holes(arr) {
10
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
11
+ }
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ function _iterable_to_array(iter) {
18
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
19
+ }
20
+ function _non_iterable_spread() {
21
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
22
+ }
23
+ function _to_consumable_array(arr) {
24
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
25
+ }
26
+ function _unsupported_iterable_to_array(o, minLen) {
27
+ if (!o) return;
28
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
29
+ var n = Object.prototype.toString.call(o).slice(8, -1);
30
+ if (n === "Object" && o.constructor) n = o.constructor.name;
31
+ if (n === "Map" || n === "Set") return Array.from(n);
32
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
33
+ }
34
+ var config = _to_consumable_array(_index.default).concat([
35
+ _eslintpluginnext.default.configs['core-web-vitals']
36
+ ]);
37
+ module.exports = config;
package/dist/index.js ADDED
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+ var _eslintpluginnext = /*#__PURE__*/ _interop_require_default(require("@next/eslint-plugin-next"));
3
+ var _eslintpluginreact = /*#__PURE__*/ _interop_require_default(require("eslint-plugin-react"));
4
+ var _eslintpluginreacthooks = /*#__PURE__*/ _interop_require_default(require("eslint-plugin-react-hooks"));
5
+ var _typescripteslint = /*#__PURE__*/ _interop_require_default(require("typescript-eslint"));
6
+ var _eslintpluginimport = /*#__PURE__*/ _interop_require_wildcard(require("eslint-plugin-import"));
7
+ var _eslintpluginjsxa11y = /*#__PURE__*/ _interop_require_wildcard(require("eslint-plugin-jsx-a11y"));
8
+ var _globals = /*#__PURE__*/ _interop_require_default(require("globals"));
9
+ var _parser = /*#__PURE__*/ _interop_require_default(require("./parser"));
10
+ function _define_property(obj, key, value) {
11
+ if (key in obj) {
12
+ Object.defineProperty(obj, key, {
13
+ value: value,
14
+ enumerable: true,
15
+ configurable: true,
16
+ writable: true
17
+ });
18
+ } else {
19
+ obj[key] = value;
20
+ }
21
+ return obj;
22
+ }
23
+ function _interop_require_default(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
+ };
27
+ }
28
+ function _getRequireWildcardCache(nodeInterop) {
29
+ if (typeof WeakMap !== "function") return null;
30
+ var cacheBabelInterop = new WeakMap();
31
+ var cacheNodeInterop = new WeakMap();
32
+ return (_getRequireWildcardCache = function(nodeInterop) {
33
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
34
+ })(nodeInterop);
35
+ }
36
+ function _interop_require_wildcard(obj, nodeInterop) {
37
+ if (!nodeInterop && obj && obj.__esModule) {
38
+ return obj;
39
+ }
40
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
41
+ return {
42
+ default: obj
43
+ };
44
+ }
45
+ var cache = _getRequireWildcardCache(nodeInterop);
46
+ if (cache && cache.has(obj)) {
47
+ return cache.get(obj);
48
+ }
49
+ var newObj = {
50
+ __proto__: null
51
+ };
52
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
53
+ for(var key in obj){
54
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
55
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
56
+ if (desc && (desc.get || desc.set)) {
57
+ Object.defineProperty(newObj, key, desc);
58
+ } else {
59
+ newObj[key] = obj[key];
60
+ }
61
+ }
62
+ }
63
+ newObj.default = obj;
64
+ if (cache) {
65
+ cache.set(obj, newObj);
66
+ }
67
+ return newObj;
68
+ }
69
+ function _object_spread(target) {
70
+ for(var i = 1; i < arguments.length; i++){
71
+ var source = arguments[i] != null ? arguments[i] : {};
72
+ var ownKeys = Object.keys(source);
73
+ if (typeof Object.getOwnPropertySymbols === "function") {
74
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
75
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
76
+ }));
77
+ }
78
+ ownKeys.forEach(function(key) {
79
+ _define_property(target, key, source[key]);
80
+ });
81
+ }
82
+ return target;
83
+ }
84
+ function ownKeys(object, enumerableOnly) {
85
+ var keys = Object.keys(object);
86
+ if (Object.getOwnPropertySymbols) {
87
+ var symbols = Object.getOwnPropertySymbols(object);
88
+ if (enumerableOnly) {
89
+ symbols = symbols.filter(function(sym) {
90
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
91
+ });
92
+ }
93
+ keys.push.apply(keys, symbols);
94
+ }
95
+ return keys;
96
+ }
97
+ function _object_spread_props(target, source) {
98
+ source = source != null ? source : {};
99
+ if (Object.getOwnPropertyDescriptors) {
100
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
101
+ } else {
102
+ ownKeys(Object(source)).forEach(function(key) {
103
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
104
+ });
105
+ }
106
+ return target;
107
+ }
108
+ var config = [
109
+ {
110
+ name: 'next',
111
+ // Default files, users can overwrite this.
112
+ files: [
113
+ '**/*.{js,jsx,mjs,ts,tsx,mts,cts}'
114
+ ],
115
+ plugins: {
116
+ react: _eslintpluginreact.default,
117
+ 'react-hooks': _eslintpluginreacthooks.default,
118
+ import: _eslintpluginimport,
119
+ 'jsx-a11y': _eslintpluginjsxa11y,
120
+ '@next/next': _eslintpluginnext.default
121
+ },
122
+ languageOptions: {
123
+ parser: _parser.default,
124
+ parserOptions: {
125
+ requireConfigFile: false,
126
+ sourceType: 'module',
127
+ allowImportExportEverywhere: true,
128
+ // TODO: Is this needed?
129
+ babelOptions: {
130
+ presets: [
131
+ 'next/babel'
132
+ ],
133
+ caller: {
134
+ // Eslint supports top level await when a parser for it is included. We enable the parser by default for Babel.
135
+ supportsTopLevelAwait: true
136
+ }
137
+ }
138
+ },
139
+ globals: _object_spread({}, _globals.default.browser, _globals.default.node)
140
+ },
141
+ settings: {
142
+ react: {
143
+ version: 'detect'
144
+ },
145
+ 'import/parsers': {
146
+ '@typescript-eslint/parser': [
147
+ '.ts',
148
+ '.mts',
149
+ '.cts',
150
+ '.tsx',
151
+ '.d.ts'
152
+ ]
153
+ },
154
+ 'import/resolver': {
155
+ node: {
156
+ extensions: [
157
+ '.js',
158
+ '.jsx',
159
+ '.ts',
160
+ '.tsx'
161
+ ]
162
+ },
163
+ typescript: {
164
+ alwaysTryTypes: true
165
+ }
166
+ }
167
+ },
168
+ rules: _object_spread_props(_object_spread({}, _eslintpluginreact.default.configs.recommended.rules, _eslintpluginreacthooks.default.configs.recommended.rules, _eslintpluginnext.default.configs.recommended.rules), {
169
+ 'import/no-anonymous-default-export': 'warn',
170
+ 'react/no-unknown-property': 'off',
171
+ 'react/react-in-jsx-scope': 'off',
172
+ 'react/prop-types': 'off',
173
+ 'jsx-a11y/alt-text': [
174
+ 'warn',
175
+ {
176
+ elements: [
177
+ 'img'
178
+ ],
179
+ img: [
180
+ 'Image'
181
+ ]
182
+ }
183
+ ],
184
+ 'jsx-a11y/aria-props': 'warn',
185
+ 'jsx-a11y/aria-proptypes': 'warn',
186
+ 'jsx-a11y/aria-unsupported-elements': 'warn',
187
+ 'jsx-a11y/role-has-required-aria-props': 'warn',
188
+ 'jsx-a11y/role-supports-aria-props': 'warn',
189
+ 'react/jsx-no-target-blank': 'off'
190
+ })
191
+ },
192
+ {
193
+ name: 'next/typescript',
194
+ // Default files, users can overwrite this.
195
+ files: [
196
+ '**/*.ts',
197
+ '**/*.tsx'
198
+ ],
199
+ plugins: {
200
+ '@typescript-eslint': _typescripteslint.default.plugin
201
+ },
202
+ languageOptions: {
203
+ parser: _typescripteslint.default.parser,
204
+ parserOptions: {
205
+ sourceType: 'module'
206
+ }
207
+ }
208
+ },
209
+ // Global ignores, users can add more `ignores` or overwrite this by `!<ignore>`.
210
+ {
211
+ ignores: [
212
+ // node_modules/ and .git/ are ignored by default.
213
+ // https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
214
+ '.next/**',
215
+ 'out/**',
216
+ 'build/**',
217
+ 'next-env.d.ts'
218
+ ]
219
+ }
220
+ ];
221
+ module.exports = config;
package/dist/parser.js ADDED
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ var _eslintparser = require("next/dist/compiled/babel/eslint-parser");
3
+ var _packagejson = require("../package.json");
4
+ var parser = {
5
+ parse: _eslintparser.parse,
6
+ parseForESLint: _eslintparser.parseForESLint,
7
+ meta: {
8
+ name: 'eslint-config-next/parser',
9
+ version: _packagejson.version
10
+ }
11
+ };
12
+ module.exports = parser;
@@ -0,0 +1,3 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const config: Linter.Config[];
3
+ export = config;
@@ -0,0 +1,3 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const config: Linter.Config[];
3
+ export = config;
@@ -0,0 +1,3 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const parser: Linter.Parser;
3
+ export = parser;
@@ -0,0 +1,3 @@
1
+ import type { Linter } from 'eslint';
2
+ declare const config: Linter.Config[];
3
+ export = config;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var _typescripteslint = /*#__PURE__*/ _interop_require_default(require("typescript-eslint"));
3
+ function _array_like_to_array(arr, len) {
4
+ if (len == null || len > arr.length) len = arr.length;
5
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6
+ return arr2;
7
+ }
8
+ function _array_without_holes(arr) {
9
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
10
+ }
11
+ function _interop_require_default(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ function _iterable_to_array(iter) {
17
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
18
+ }
19
+ function _non_iterable_spread() {
20
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
21
+ }
22
+ function _to_consumable_array(arr) {
23
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
24
+ }
25
+ function _unsupported_iterable_to_array(o, minLen) {
26
+ if (!o) return;
27
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
28
+ var n = Object.prototype.toString.call(o).slice(8, -1);
29
+ if (n === "Object" && o.constructor) n = o.constructor.name;
30
+ if (n === "Map" || n === "Set") return Array.from(n);
31
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
32
+ }
33
+ var config = _to_consumable_array(_typescripteslint.default.configs.recommended).concat([
34
+ {
35
+ rules: {
36
+ '@typescript-eslint/no-unused-vars': 'warn',
37
+ '@typescript-eslint/no-unused-expressions': 'warn'
38
+ }
39
+ },
40
+ // Global ignores, users can add more `ignores` or overwrite this by `!<ignore>`.
41
+ {
42
+ ignores: [
43
+ // node_modules/ and .git/ are ignored by default.
44
+ // https://eslint.org/docs/latest/use/configure/configuration-files#globally-ignoring-files-with-ignores
45
+ '.next/**',
46
+ 'out/**',
47
+ 'build/**',
48
+ 'next-env.d.ts'
49
+ ]
50
+ }
51
+ ]);
52
+ module.exports = config;
package/package.json CHANGED
@@ -1,33 +1,63 @@
1
1
  {
2
2
  "name": "eslint-config-next",
3
- "version": "16.0.0-canary.5",
3
+ "version": "16.0.0-canary.6",
4
4
  "description": "ESLint configuration used by Next.js.",
5
- "main": "index.js",
6
5
  "license": "MIT",
7
6
  "repository": {
8
7
  "url": "vercel/next.js",
9
8
  "directory": "packages/eslint-config-next"
10
9
  },
11
10
  "homepage": "https://nextjs.org/docs/app/api-reference/config/eslint",
11
+ "files": [
12
+ "dist"
13
+ ],
12
14
  "dependencies": {
13
- "@next/eslint-plugin-next": "16.0.0-canary.5",
14
- "@rushstack/eslint-patch": "^1.10.3",
15
- "@typescript-eslint/eslint-plugin": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
16
- "@typescript-eslint/parser": "^5.4.2 || ^6.0.0 || ^7.0.0 || ^8.0.0",
15
+ "@next/eslint-plugin-next": "16.0.0-canary.6",
17
16
  "eslint-import-resolver-node": "^0.3.6",
18
17
  "eslint-import-resolver-typescript": "^3.5.2",
19
- "eslint-plugin-import": "^2.31.0",
18
+ "eslint-plugin-import": "^2.32.0",
20
19
  "eslint-plugin-jsx-a11y": "^6.10.0",
21
20
  "eslint-plugin-react": "^7.37.0",
22
- "eslint-plugin-react-hooks": "^7.0.0"
21
+ "eslint-plugin-react-hooks": "^7.0.0",
22
+ "globals": "16.4.0",
23
+ "typescript-eslint": "^8.46.0"
23
24
  },
24
25
  "peerDependencies": {
25
- "eslint": "^7.23.0 || ^8.0.0 || ^9.0.0",
26
+ "eslint": ">=9.0.0",
26
27
  "typescript": ">=3.3.1"
27
28
  },
28
29
  "peerDependenciesMeta": {
29
30
  "typescript": {
30
31
  "optional": true
31
32
  }
33
+ },
34
+ "devDependencies": {
35
+ "@types/eslint": "9.6.1",
36
+ "@types/eslint-plugin-jsx-a11y": "6.10.1",
37
+ "typescript": "5.9.2"
38
+ },
39
+ "scripts": {
40
+ "dev": "pnpm build",
41
+ "build": "swc -d dist src && pnpm types",
42
+ "types": "tsc --skipLibCheck --declaration --emitDeclarationOnly --esModuleInterop --outDir dist",
43
+ "prepublishOnly": "cd ../../ && turbo run build"
44
+ },
45
+ "exports": {
46
+ ".": {
47
+ "types": "./dist/index.d.ts",
48
+ "default": "./dist/index.js"
49
+ },
50
+ "./core-web-vitals": {
51
+ "types": "./dist/core-web-vitals.d.ts",
52
+ "default": "./dist/core-web-vitals.js"
53
+ },
54
+ "./typescript": {
55
+ "types": "./dist/typescript.d.ts",
56
+ "default": "./dist/typescript.js"
57
+ },
58
+ "./parser": {
59
+ "types": "./dist/parser.d.ts",
60
+ "default": "./dist/parser.js"
61
+ }
32
62
  }
33
63
  }
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: [require.resolve('.'), 'plugin:@next/next/core-web-vitals-legacy'],
3
- }
package/index.js DELETED
@@ -1,129 +0,0 @@
1
- /*
2
- * @rushstack/eslint-patch is used to include plugins as dev
3
- * dependencies instead of imposing them as peer dependencies
4
- *
5
- * https://www.npmjs.com/package/@rushstack/eslint-patch
6
- */
7
- const keptPaths = []
8
- const sortedPaths = []
9
- const cwd = process.cwd().replace(/\\/g, '/')
10
- const originalPaths = require.resolve.paths('eslint-plugin-import')
11
-
12
- // eslint throws a conflict error when plugins resolve to different
13
- // locations, since we want to lock our dependencies by default
14
- // but also need to allow using user dependencies this updates
15
- // our resolve paths to first check the cwd and iterate to
16
- // eslint-config-next's dependencies if needed
17
-
18
- for (let i = originalPaths.length - 1; i >= 0; i--) {
19
- const currentPath = originalPaths[i]
20
-
21
- if (currentPath.replace(/\\/g, '/').startsWith(cwd)) {
22
- sortedPaths.push(currentPath)
23
- } else {
24
- keptPaths.unshift(currentPath)
25
- }
26
- }
27
-
28
- // maintain order of node_modules outside of cwd
29
- sortedPaths.push(...keptPaths)
30
-
31
- const hookPropertyMap = new Map(
32
- [
33
- '@typescript-eslint/eslint-plugin',
34
- 'eslint-plugin-import',
35
- 'eslint-plugin-react',
36
- 'eslint-plugin-jsx-a11y',
37
- ].map((request) => [
38
- request,
39
- require.resolve(request, { paths: sortedPaths }),
40
- ])
41
- )
42
-
43
- const mod = require('module')
44
- const resolveFilename = mod._resolveFilename
45
- mod._resolveFilename = function (request, parent, isMain, options) {
46
- const hookResolved = hookPropertyMap.get(request)
47
- if (hookResolved) {
48
- request = hookResolved
49
- }
50
- return resolveFilename.call(mod, request, parent, isMain, options)
51
- }
52
-
53
- require('@rushstack/eslint-patch/modern-module-resolution')
54
-
55
- module.exports = {
56
- extends: [
57
- 'plugin:react/recommended',
58
- 'plugin:react-hooks/recommended',
59
- 'plugin:@next/next/recommended-legacy',
60
- ],
61
- plugins: ['import', 'react', 'jsx-a11y'],
62
- rules: {
63
- 'import/no-anonymous-default-export': 'warn',
64
- 'react/no-unknown-property': 'off',
65
- 'react/react-in-jsx-scope': 'off',
66
- 'react/prop-types': 'off',
67
- 'jsx-a11y/alt-text': [
68
- 'warn',
69
- {
70
- elements: ['img'],
71
- img: ['Image'],
72
- },
73
- ],
74
- 'jsx-a11y/aria-props': 'warn',
75
- 'jsx-a11y/aria-proptypes': 'warn',
76
- 'jsx-a11y/aria-unsupported-elements': 'warn',
77
- 'jsx-a11y/role-has-required-aria-props': 'warn',
78
- 'jsx-a11y/role-supports-aria-props': 'warn',
79
- 'react/jsx-no-target-blank': 'off',
80
- },
81
- parser: './parser.js',
82
- parserOptions: {
83
- requireConfigFile: false,
84
- sourceType: 'module',
85
- allowImportExportEverywhere: true,
86
- babelOptions: {
87
- presets: ['next/babel'],
88
- caller: {
89
- // Eslint supports top level await when a parser for it is included. We enable the parser by default for Babel.
90
- supportsTopLevelAwait: true,
91
- },
92
- },
93
- },
94
- overrides: [
95
- {
96
- files: ['**/*.ts?(x)'],
97
- parser: '@typescript-eslint/parser',
98
- parserOptions: {
99
- sourceType: 'module',
100
- },
101
- },
102
- ],
103
- settings: {
104
- react: {
105
- version: 'detect',
106
- },
107
- 'import/parsers': {
108
- [require.resolve('@typescript-eslint/parser')]: [
109
- '.ts',
110
- '.mts',
111
- '.cts',
112
- '.tsx',
113
- '.d.ts',
114
- ],
115
- },
116
- 'import/resolver': {
117
- [require.resolve('eslint-import-resolver-node')]: {
118
- extensions: ['.js', '.jsx', '.ts', '.tsx'],
119
- },
120
- [require.resolve('eslint-import-resolver-typescript')]: {
121
- alwaysTryTypes: true,
122
- },
123
- },
124
- },
125
- env: {
126
- browser: true,
127
- node: true,
128
- },
129
- }
package/parser.js DELETED
@@ -1,14 +0,0 @@
1
- const {
2
- parse,
3
- parseForESLint,
4
- } = require('next/dist/compiled/babel/eslint-parser')
5
- const { version } = require('./package.json')
6
-
7
- module.exports = {
8
- parse,
9
- parseForESLint,
10
- meta: {
11
- name: 'eslint-config-next/parser',
12
- version,
13
- },
14
- }
package/typescript.js DELETED
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- extends: ['plugin:@typescript-eslint/recommended'],
3
- rules: {
4
- '@typescript-eslint/no-unused-vars': 1,
5
- '@typescript-eslint/no-unused-expressions': 1,
6
- },
7
- }