eslint-plugin-legion 0.1.0 → 0.4.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/CHANGELOG.md +94 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,99 @@
|
|
|
1
1
|
# eslint-plugin-legion
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- legion-rules@0.4.0
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 649a264: Ten new rules, a platform split, and the React Compiler flag actually working.
|
|
14
|
+
|
|
15
|
+
Two of the rules were already law in LEGION-STANDARDS with no mechanical
|
|
16
|
+
check, which is the drift §8.1 warns about: `no-hardcoded-hex` (§7, §10 lists
|
|
17
|
+
it under automatic rejection) and `no-rn-button` (§3 mandates
|
|
18
|
+
`TouchableOpacity`, not `Button`). The rest are silent-default bugs rather
|
|
19
|
+
than style: `button-has-type` (HTML defaults a bare button to `submit`, so
|
|
20
|
+
one inside a form reloads the page), `no-target-blank-without-rel`,
|
|
21
|
+
`anchor-is-not-a-button`, `img-has-alt`, `no-dangerous-html`,
|
|
22
|
+
`no-array-index-key`, `touchable-has-accessibility-label` and
|
|
23
|
+
`controlled-text-input`.
|
|
24
|
+
|
|
25
|
+
Rules now know their platform. `WEB_ONLY_RULES` gained the five DOM rules and
|
|
26
|
+
a mirrored `NATIVE_ONLY_RULES` holds the three React Native ones, so a config
|
|
27
|
+
only runs what can fire on its platform: the DOM rules are off under
|
|
28
|
+
`reactNative`, the native rules off everywhere else, and `no-hardcoded-hex`
|
|
29
|
+
and `no-array-index-key` run in both.
|
|
30
|
+
|
|
31
|
+
New rules land at level 1 in `recommended` and 3 in `strict`. The cohort is
|
|
32
|
+
exported as `INTRODUCED_AT_WARN`, so promoting them later is one edit and the
|
|
33
|
+
preset tests fail if the policy changes silently. Adding a rule should never
|
|
34
|
+
turn an existing repo's build red for code written before it existed.
|
|
35
|
+
|
|
36
|
+
`reactCompiler: true` now works when composed with a preset. It only enabled
|
|
37
|
+
`no-manual-memo` when the rule was `undefined`, but both presets set it to
|
|
38
|
+
`0` explicitly, so the flag was inert for every documented way of using it.
|
|
39
|
+
`legion-audit` also detects the compiler now — from
|
|
40
|
+
`babel-plugin-react-compiler`, `eslint-plugin-react-compiler`, or
|
|
41
|
+
`reactCompiler` in a Next config, never from the React version, since React
|
|
42
|
+
19 does not imply the compiler — and nudges when it is on while the rule is
|
|
43
|
+
off.
|
|
44
|
+
|
|
45
|
+
`no-hardcoded-hex` is off in test files, since a rule's own fixtures have to
|
|
46
|
+
contain the thing it forbids.
|
|
47
|
+
|
|
48
|
+
### Patch Changes
|
|
49
|
+
|
|
50
|
+
- Updated dependencies [649a264]
|
|
51
|
+
- legion-rules@0.3.0
|
|
52
|
+
|
|
53
|
+
## 0.2.0
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- 4d0ccf6: React Native support and an advice layer.
|
|
58
|
+
|
|
59
|
+
`legion-rules` gains a `reactNative` preset and a `reactNative: true` flag on
|
|
60
|
+
`defineLegionConfig`. It turns off the two rules that can only describe a
|
|
61
|
+
server-rendered page, widens `no-admin-client-in-browser` to every file
|
|
62
|
+
because a device bundle has no unreachable half, and adds the `src/`-prefixed
|
|
63
|
+
`any` boundaries. `eslint-plugin-legion` exposes it as
|
|
64
|
+
`configs.reactNative`.
|
|
65
|
+
|
|
66
|
+
`legion-audit` gains three things. An `expo-doctor` gate on Expo projects
|
|
67
|
+
that keeps a real version incompatibility blocking while demoting
|
|
68
|
+
patch-level drift to a nudge. Workspace awareness, so a package inside a
|
|
69
|
+
monorepo finds the lockfile and the hoisted bins at the workspace root
|
|
70
|
+
instead of reporting them missing. And a nudge layer: every run now ends with
|
|
71
|
+
what the repo could do better, why, and the command, including migrating off
|
|
72
|
+
npm or Yarn Classic to Yarn Berry in whichever package manager is currently
|
|
73
|
+
in use. Nudges never affect the score or the exit code. `legion-audit advice`
|
|
74
|
+
prints only those.
|
|
75
|
+
|
|
76
|
+
Two scoring changes, both so the number measures what the current code
|
|
77
|
+
controls. PR hygiene no longer scores at all: it reads history on `main`,
|
|
78
|
+
cannot be fixed retroactively, and section 12 only requires a PR on a client
|
|
79
|
+
repo, so it is now a nudge. And the test penalty is the _share_ of components
|
|
80
|
+
and hooks left uncovered rather than the count, so decomposing one oversized
|
|
81
|
+
component into ten presentational children cannot make the score worse than
|
|
82
|
+
the component it replaced. `findRegressions` compares the same share for the
|
|
83
|
+
same reason.
|
|
84
|
+
|
|
85
|
+
Test coverage is now measured rather than guessed. The audit reads
|
|
86
|
+
`coverage/coverage-summary.json` when it exists, then Istanbul's
|
|
87
|
+
`coverage-final.json` (which is what Jest's default reporters write, so it is
|
|
88
|
+
the more common of the two), then falls back to what the test files actually
|
|
89
|
+
import and `describe`, and only then to matching base names. A single test
|
|
90
|
+
file covering many components now counts for all of them.
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- Updated dependencies [4d0ccf6]
|
|
95
|
+
- legion-rules@0.2.0
|
|
96
|
+
|
|
3
97
|
## 0.1.0
|
|
4
98
|
|
|
5
99
|
### Minor Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { recommended as recommendedConfig, rules, strict as strictConfig } from 'legion-rules';
|
|
1
|
+
import { reactNative as reactNativeConfig, recommended as recommendedConfig, rules, strict as strictConfig } from 'legion-rules';
|
|
2
2
|
import type { EslintExtras, EslintFlatConfig, LegionConfig, LegionConfigInput } from 'legion-rules';
|
|
3
3
|
export interface LegionPlugin {
|
|
4
4
|
meta: {
|
|
@@ -9,11 +9,12 @@ export interface LegionPlugin {
|
|
|
9
9
|
configs: {
|
|
10
10
|
recommended: EslintFlatConfig[];
|
|
11
11
|
strict: EslintFlatConfig[];
|
|
12
|
+
reactNative: EslintFlatConfig[];
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
declare const plugin: LegionPlugin;
|
|
15
16
|
export declare const legionEslintConfig: (config: LegionConfig | LegionConfigInput, extras?: EslintExtras) => EslintFlatConfig[];
|
|
16
17
|
export declare const legionOxlintConfig: (config: LegionConfigInput) => import("legion-rules").OxlintConfig;
|
|
17
|
-
export { recommendedConfig as recommended, strictConfig as strict, rules };
|
|
18
|
+
export { recommendedConfig as recommended, strictConfig as strict, reactNativeConfig as reactNative, rules, };
|
|
18
19
|
export default plugin;
|
|
19
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,IAAI,iBAAiB,EAChC,KAAK,EACL,MAAM,IAAI,YAAY,EACvB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,EAAE;QACP,WAAW,EAAE,gBAAgB,EAAE,CAAC;QAChC,MAAM,EAAE,gBAAgB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,IAAI,iBAAiB,EAChC,WAAW,IAAI,iBAAiB,EAChC,KAAK,EACL,MAAM,IAAI,YAAY,EACvB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EAClB,MAAM,cAAc,CAAC;AAKtB,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,OAAO,EAAE;QACP,WAAW,EAAE,gBAAgB,EAAE,CAAC;QAChC,MAAM,EAAE,gBAAgB,EAAE,CAAC;QAC3B,WAAW,EAAE,gBAAgB,EAAE,CAAC;KACjC,CAAC;CACH;AAED,QAAA,MAAM,MAAM,EAAE,YAIb,CAAC;AAMF,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,YAAY,GAAG,iBAAiB,EACxC,SAAS,YAAY,KACpB,gBAAgB,EAKlB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,QAAQ,iBAAiB,wCACzB,CAAC;AAEpC,OAAO,EACL,iBAAiB,IAAI,WAAW,EAChC,YAAY,IAAI,MAAM,EACtB,iBAAiB,IAAI,WAAW,EAChC,KAAK,GACN,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { defineLegionConfig, recommended as recommendedConfig, rules, strict as strictConfig, } from 'legion-rules';
|
|
2
|
+
import { defineLegionConfig, reactNative as reactNativeConfig, recommended as recommendedConfig, rules, strict as strictConfig, } from 'legion-rules';
|
|
3
3
|
const require = createRequire(import.meta.url);
|
|
4
4
|
const { version } = require('../package.json');
|
|
5
5
|
const plugin = {
|
|
6
6
|
meta: { name: 'legion', version },
|
|
7
7
|
rules,
|
|
8
|
-
configs: { recommended: [], strict: [] },
|
|
8
|
+
configs: { recommended: [], strict: [], reactNative: [] },
|
|
9
9
|
};
|
|
10
10
|
plugin.configs.recommended = recommendedConfig.eslint(plugin);
|
|
11
11
|
plugin.configs.strict = strictConfig.eslint(plugin);
|
|
12
|
+
plugin.configs.reactNative = reactNativeConfig.eslint(plugin);
|
|
12
13
|
export const legionEslintConfig = (config, extras) => {
|
|
13
14
|
if ('eslint' in config && typeof config.eslint === 'function') {
|
|
14
15
|
return config.eslint(plugin, extras);
|
|
@@ -16,6 +17,6 @@ export const legionEslintConfig = (config, extras) => {
|
|
|
16
17
|
return defineLegionConfig(config).eslint(plugin, extras);
|
|
17
18
|
};
|
|
18
19
|
export const legionOxlintConfig = (config) => defineLegionConfig(config).oxlint;
|
|
19
|
-
export { recommendedConfig as recommended, strictConfig as strict, rules };
|
|
20
|
+
export { recommendedConfig as recommended, strictConfig as strict, reactNativeConfig as reactNative, rules, };
|
|
20
21
|
export default plugin;
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,WAAW,IAAI,iBAAiB,EAChC,KAAK,EACL,MAAM,IAAI,YAAY,GACvB,MAAM,cAAc,CAAC;AAQtB,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,kBAAkB,EAClB,WAAW,IAAI,iBAAiB,EAChC,WAAW,IAAI,iBAAiB,EAChC,KAAK,EACL,MAAM,IAAI,YAAY,GACvB,MAAM,cAAc,CAAC;AAQtB,MAAM,OAAO,GA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@@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-legion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "LEGION-STANDARDS as a lint plugin. Runs under oxlint (jsPlugins) and ESLint v9+. Zero comments, no React.FC, no enum, no ternaries, no function keyword, guarded context hooks, hydration-safe state, server-first pages, scoped lint bypasses.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Veracium LLC",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"registry": "https://registry.npmjs.org/"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"legion-rules": "^0.
|
|
50
|
+
"legion-rules": "^0.4.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"eslint": ">=9",
|