@dloizides/frontend-devtools 1.0.1 → 1.0.2
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/eslint/index.d.mts +77 -0
- package/dist/eslint/index.d.ts +77 -0
- package/dist/eslint/index.js +2000 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/index.mjs +1990 -0
- package/dist/eslint/index.mjs.map +1 -0
- package/dist/index.d.mts +71 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +2029 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2017 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +6 -1
- package/.eslintrc.js +0 -34
- package/jest.config.js +0 -24
- package/publish.ps1 +0 -107
- package/src/eslint/index.ts +0 -16
- package/src/eslint/legacy.ts +0 -44
- package/src/eslint/plugin.test.ts +0 -60
- package/src/eslint/plugin.ts +0 -87
- package/src/eslint/rules.behaviour.test.ts +0 -86
- package/src/eslint/rules.d.ts +0 -16
- package/src/eslint/types.ts +0 -27
- package/src/i18n/initI18n.test.ts +0 -101
- package/src/i18n/initI18n.ts +0 -109
- package/src/index.ts +0 -31
- package/src/rules/enforce-function-style.js +0 -278
- package/src/rules/enforce-module-structure.js +0 -323
- package/src/rules/enforce-route-preload.js +0 -288
- package/src/rules/enforce-test-colocation.js +0 -82
- package/src/rules/enum-file-isolation.js +0 -149
- package/src/rules/i18n-interpolation.js +0 -185
- package/src/rules/i18n-param-names.js +0 -119
- package/src/rules/no-barrel-companion-file.js +0 -142
- package/src/rules/no-duplicate-nav-prefix.js +0 -107
- package/src/rules/no-duplicate-shared-patterns.js +0 -166
- package/src/rules/no-generated-models-barrel-value-import.js +0 -70
- package/src/rules/no-null-check.js +0 -171
- package/src/rules/no-optional-undefined.js +0 -99
- package/src/rules/no-product-imports-in-shared.js +0 -164
- package/src/rules/prefer-const-enum.js +0 -127
- package/src/rules/require-stable-hook-args.js +0 -372
- package/src/rules/smart-max-lines.js +0 -344
- package/tsconfig.json +0 -25
- package/tsconfig.test.json +0 -11
- package/tsup.config.ts +0 -14
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Rule, Linter } from 'eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A single custom ESLint rule implementation (the object passed to ESLint's
|
|
5
|
+
* `RuleTester`). The rule `.mjs` files export `{ rules: { '<name>': rule } }`.
|
|
6
|
+
*/
|
|
7
|
+
type CustomRule = Rule.RuleModule;
|
|
8
|
+
/**
|
|
9
|
+
* The shape each rule `.mjs` module default-exports: a one-rule plugin object.
|
|
10
|
+
*/
|
|
11
|
+
interface SingleRulePlugin {
|
|
12
|
+
rules: Record<string, CustomRule>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* An ESLint flat-config plugin object: a name + the merged rule map.
|
|
16
|
+
*/
|
|
17
|
+
interface FlatConfigPlugin {
|
|
18
|
+
meta: {
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
};
|
|
22
|
+
rules: Record<string, CustomRule>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A flat-config block (the entries of an `eslint.config.mjs` array).
|
|
26
|
+
*/
|
|
27
|
+
type FlatConfig = Linter.FlatConfig;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The flat-config plugin object. Register it under a namespace in the app's
|
|
31
|
+
* `eslint.config.mjs`:
|
|
32
|
+
*
|
|
33
|
+
* ```js
|
|
34
|
+
* import { plugin as devtools } from '@dloizides/frontend-devtools/eslint';
|
|
35
|
+
* export default [{ plugins: { '@dloizides': devtools }, rules: {
|
|
36
|
+
* '@dloizides/no-null-check': 'error',
|
|
37
|
+
* } }];
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const plugin: FlatConfigPlugin;
|
|
41
|
+
/**
|
|
42
|
+
* The merged rule map alone (the same `Record<name, rule>` that the apps used to
|
|
43
|
+
* spread from 17 separate `eslint-plugins/*.mjs` files).
|
|
44
|
+
*/
|
|
45
|
+
declare const rules: Record<string, CustomRule>;
|
|
46
|
+
/**
|
|
47
|
+
* The list of rule names this plugin provides. Useful for migration assertions
|
|
48
|
+
* (prove no rule was dropped vs. the old 17 local files).
|
|
49
|
+
*/
|
|
50
|
+
declare const ruleNames: readonly string[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The apps historically registered each custom rule under a namespace EQUAL to
|
|
54
|
+
* its rule name, e.g. `plugins: { 'no-null-check': plugin }` with the rule keyed
|
|
55
|
+
* as `'no-null-check/no-null-check'`. Inline `eslint-disable-next-line
|
|
56
|
+
* no-null-check/no-null-check` comments and config keys depend on that exact
|
|
57
|
+
* `<name>/<name>` shape.
|
|
58
|
+
*
|
|
59
|
+
* To migrate WITHOUT changing a single config key or disable comment, the app
|
|
60
|
+
* spreads {@link legacyPlugins} into its flat config's `plugins` map. Each rule
|
|
61
|
+
* name maps to a one-rule plugin object holding that rule — reproducing the old
|
|
62
|
+
* `import xPlugin from './eslint-plugins/x.mjs'` registration byte-for-byte.
|
|
63
|
+
*
|
|
64
|
+
* ```js
|
|
65
|
+
* import { legacyPlugins } from '@dloizides/frontend-devtools/eslint';
|
|
66
|
+
* export default [{
|
|
67
|
+
* plugins: { ...legacyPlugins },
|
|
68
|
+
* rules: {
|
|
69
|
+
* 'no-null-check/no-null-check': 'error', // unchanged
|
|
70
|
+
* 'smart-max-lines/smart-max-lines': ['error', { functionMax: 50 }],
|
|
71
|
+
* },
|
|
72
|
+
* }];
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const legacyPlugins: Record<string, FlatConfigPlugin>;
|
|
76
|
+
|
|
77
|
+
export { type CustomRule, type FlatConfig, type FlatConfigPlugin, type SingleRulePlugin, legacyPlugins, plugin, ruleNames, rules };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Rule, Linter } from 'eslint';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A single custom ESLint rule implementation (the object passed to ESLint's
|
|
5
|
+
* `RuleTester`). The rule `.mjs` files export `{ rules: { '<name>': rule } }`.
|
|
6
|
+
*/
|
|
7
|
+
type CustomRule = Rule.RuleModule;
|
|
8
|
+
/**
|
|
9
|
+
* The shape each rule `.mjs` module default-exports: a one-rule plugin object.
|
|
10
|
+
*/
|
|
11
|
+
interface SingleRulePlugin {
|
|
12
|
+
rules: Record<string, CustomRule>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* An ESLint flat-config plugin object: a name + the merged rule map.
|
|
16
|
+
*/
|
|
17
|
+
interface FlatConfigPlugin {
|
|
18
|
+
meta: {
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
};
|
|
22
|
+
rules: Record<string, CustomRule>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A flat-config block (the entries of an `eslint.config.mjs` array).
|
|
26
|
+
*/
|
|
27
|
+
type FlatConfig = Linter.FlatConfig;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The flat-config plugin object. Register it under a namespace in the app's
|
|
31
|
+
* `eslint.config.mjs`:
|
|
32
|
+
*
|
|
33
|
+
* ```js
|
|
34
|
+
* import { plugin as devtools } from '@dloizides/frontend-devtools/eslint';
|
|
35
|
+
* export default [{ plugins: { '@dloizides': devtools }, rules: {
|
|
36
|
+
* '@dloizides/no-null-check': 'error',
|
|
37
|
+
* } }];
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
declare const plugin: FlatConfigPlugin;
|
|
41
|
+
/**
|
|
42
|
+
* The merged rule map alone (the same `Record<name, rule>` that the apps used to
|
|
43
|
+
* spread from 17 separate `eslint-plugins/*.mjs` files).
|
|
44
|
+
*/
|
|
45
|
+
declare const rules: Record<string, CustomRule>;
|
|
46
|
+
/**
|
|
47
|
+
* The list of rule names this plugin provides. Useful for migration assertions
|
|
48
|
+
* (prove no rule was dropped vs. the old 17 local files).
|
|
49
|
+
*/
|
|
50
|
+
declare const ruleNames: readonly string[];
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The apps historically registered each custom rule under a namespace EQUAL to
|
|
54
|
+
* its rule name, e.g. `plugins: { 'no-null-check': plugin }` with the rule keyed
|
|
55
|
+
* as `'no-null-check/no-null-check'`. Inline `eslint-disable-next-line
|
|
56
|
+
* no-null-check/no-null-check` comments and config keys depend on that exact
|
|
57
|
+
* `<name>/<name>` shape.
|
|
58
|
+
*
|
|
59
|
+
* To migrate WITHOUT changing a single config key or disable comment, the app
|
|
60
|
+
* spreads {@link legacyPlugins} into its flat config's `plugins` map. Each rule
|
|
61
|
+
* name maps to a one-rule plugin object holding that rule — reproducing the old
|
|
62
|
+
* `import xPlugin from './eslint-plugins/x.mjs'` registration byte-for-byte.
|
|
63
|
+
*
|
|
64
|
+
* ```js
|
|
65
|
+
* import { legacyPlugins } from '@dloizides/frontend-devtools/eslint';
|
|
66
|
+
* export default [{
|
|
67
|
+
* plugins: { ...legacyPlugins },
|
|
68
|
+
* rules: {
|
|
69
|
+
* 'no-null-check/no-null-check': 'error', // unchanged
|
|
70
|
+
* 'smart-max-lines/smart-max-lines': ['error', { functionMax: 50 }],
|
|
71
|
+
* },
|
|
72
|
+
* }];
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
declare const legacyPlugins: Record<string, FlatConfigPlugin>;
|
|
76
|
+
|
|
77
|
+
export { type CustomRule, type FlatConfig, type FlatConfigPlugin, type SingleRulePlugin, legacyPlugins, plugin, ruleNames, rules };
|