@ankhorage/devtools 1.15.9 → 1.16.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
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/devtools
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Shared tooling, repository automation, runtime policies, and agent standards for Ankhorage TypeScript projects
|
|
9
9
|
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The default `profile: 'auto'` reads the nearest `package.json` from `tsconfigRootDir` and uses
|
|
5
5
|
* `@ankhorage/project-detector` to select overlapping project traits. React Native and Expo select
|
|
6
|
-
*
|
|
6
|
+
* `react-native`, Next.js selects `next`, React selects `react`, and other projects use `base`.
|
|
7
7
|
*
|
|
8
8
|
* Every profile includes the shared TypeScript, import, unused-import, Prettier, security, and
|
|
9
9
|
* quality rules. The common quality limits are 50 effective lines per function, 300 effective
|
|
10
10
|
* lines per file, and modified cyclomatic complexity 15. React adds React and Hooks correctness
|
|
11
|
-
* rules;
|
|
11
|
+
* rules; Next.js composes React with Next recommended/Core Web Vitals rules; React Native composes
|
|
12
|
+
* React with focused React Native rules.
|
|
12
13
|
*
|
|
13
14
|
* Repository-specific behavior stays additive: `additionalIgnores`, `restrictedImports`, and
|
|
14
15
|
* `overrides` extend the central policy instead of replacing it. Narrow local overrides remain the
|
|
@@ -19,6 +20,7 @@
|
|
|
19
20
|
*/
|
|
20
21
|
import { fixupPluginRules } from '@eslint/compat';
|
|
21
22
|
import js from '@eslint/js';
|
|
23
|
+
import nextPlugin from '@next/eslint-plugin-next';
|
|
22
24
|
import { defineConfig } from 'eslint/config';
|
|
23
25
|
import prettierConfig from 'eslint-config-prettier';
|
|
24
26
|
import importPlugin from 'eslint-plugin-import';
|
|
@@ -151,11 +153,14 @@ function createSecurityRules() {
|
|
|
151
153
|
};
|
|
152
154
|
}
|
|
153
155
|
function createProfileConfigs(profile, files) {
|
|
154
|
-
if (profile === 'base')
|
|
156
|
+
if (profile === 'base')
|
|
155
157
|
return [];
|
|
156
|
-
}
|
|
157
158
|
const reactConfig = createReactConfig(files);
|
|
158
|
-
|
|
159
|
+
if (profile === 'next')
|
|
160
|
+
return [reactConfig, createNextConfig(files)];
|
|
161
|
+
if (profile === 'react-native')
|
|
162
|
+
return [reactConfig, createReactNativeConfig(files)];
|
|
163
|
+
return [reactConfig];
|
|
159
164
|
}
|
|
160
165
|
function createReactConfig(files) {
|
|
161
166
|
return {
|
|
@@ -178,6 +183,17 @@ function createReactConfig(files) {
|
|
|
178
183
|
},
|
|
179
184
|
};
|
|
180
185
|
}
|
|
186
|
+
/*** Add Next.js rules without re-registering React, Hooks, TypeScript, or import plugins. */
|
|
187
|
+
function createNextConfig(files) {
|
|
188
|
+
return {
|
|
189
|
+
files,
|
|
190
|
+
plugins: { '@next/next': nextPlugin },
|
|
191
|
+
rules: {
|
|
192
|
+
...nextPlugin.configs.recommended.rules,
|
|
193
|
+
...nextPlugin.configs['core-web-vitals'].rules,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
181
197
|
function createReactNativeConfig(files) {
|
|
182
198
|
return {
|
|
183
199
|
files,
|
|
@@ -6,5 +6,7 @@ export function resolveEslintProfileFromDetectionInput(requestedProfile, input)
|
|
|
6
6
|
const { traits } = detectProject(input);
|
|
7
7
|
if (traits.has('react-native') || traits.has('expo'))
|
|
8
8
|
return 'react-native';
|
|
9
|
+
if (traits.has('next'))
|
|
10
|
+
return 'next';
|
|
9
11
|
return traits.has('react') ? 'react' : 'base';
|
|
10
12
|
}
|
|
@@ -4,7 +4,7 @@ export interface RestrictedImport {
|
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly message: string;
|
|
6
6
|
}
|
|
7
|
-
export type DevtoolsEslintProfile = 'auto' | 'base' | 'react' | 'react-native';
|
|
7
|
+
export type DevtoolsEslintProfile = 'auto' | 'base' | 'next' | 'react' | 'react-native';
|
|
8
8
|
export type ResolvedDevtoolsEslintProfile = Exclude<DevtoolsEslintProfile, 'auto'>;
|
|
9
9
|
export interface DevtoolsConfigOptions {
|
|
10
10
|
readonly tsconfigRootDir: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/devtools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Shared tooling, repository automation, runtime policies, and agent standards for Ankhorage TypeScript projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/devtools#readme",
|
|
@@ -127,6 +127,7 @@
|
|
|
127
127
|
"@changesets/cli": "^3.0.2",
|
|
128
128
|
"@eslint/compat": "^2.1.1",
|
|
129
129
|
"@eslint/js": "^10.0.1",
|
|
130
|
+
"@next/eslint-plugin-next": "^16.3.5",
|
|
130
131
|
"eslint": "^10.10.0",
|
|
131
132
|
"eslint-config-prettier": "^10.1.8",
|
|
132
133
|
"eslint-plugin-import": "^2.32.0",
|