refactor: address frontend review feedback
Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 8m54s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 12s
Frontend verify / verify (push) Successful in 9m59s
Frontend verify / commits (pull_request) Successful in 29s
Frontend verify / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Successful in 8m54s
Frontend verify / commits (push) Skipped
Frontend verify / security (push) Successful in 12s
Frontend verify / verify (push) Successful in 9m59s
This commit was merged in pull request #43.
This commit is contained in:
+23
-1
@@ -130,7 +130,7 @@ test("ESLint enforces the frontend profile and excludes generated artifacts", as
|
||||
assert.equal(story.rules["react-refresh/only-export-components"], undefined);
|
||||
});
|
||||
|
||||
test("all recommended plugin rules remain enabled in their intended scopes", async () => {
|
||||
test("recommended plugin rules retain the explicit null-contract exception", async () => {
|
||||
const eslint = new ESLint();
|
||||
const source = "src/shared/api/problem-details.ts";
|
||||
const component = "packages/ui/src/EntryCard/EntryCard.tsx";
|
||||
@@ -175,6 +175,12 @@ test("all recommended plugin rules remain enabled in their intended scopes", asy
|
||||
for (const [rule, setting] of Object.entries(expected)) {
|
||||
const severity = Array.isArray(setting) ? setting[0] : setting;
|
||||
if (severity === "off" || severity === 0 || !rule.includes("/")) continue;
|
||||
|
||||
if (rule === "unicorn/no-null") {
|
||||
assert.equal(actual.get(rule)?.[0], 0);
|
||||
continue;
|
||||
}
|
||||
|
||||
assert.ok(actual.get(rule)?.[0] > 0, `${filePath}: ${rule}`);
|
||||
}
|
||||
}
|
||||
@@ -316,3 +322,19 @@ test("JSX spacing fixes preserve text interpolation and are stable", async () =>
|
||||
assert.equal(again.output, undefined);
|
||||
assert.equal(again.errorCount, 0);
|
||||
});
|
||||
|
||||
test("compact JSX and contract nulls need no local suppressions", async () => {
|
||||
const eslint = new ESLint({ fix: true });
|
||||
const filePath = "packages/ui/src/EntryCard/EntryCard.tsx";
|
||||
const code = "import type { FC } from 'react'; type Props = { active: boolean }; const Example: FC<Props> = (props) => props.active ? <span /> : <div />;\nexport { Example };";
|
||||
const [fixed] = await eslint.lintText(code, { filePath });
|
||||
assert.equal(fixed.errorCount, 0);
|
||||
assert.match(fixed.output ?? code, /\? <span \/> : <div \/>/);
|
||||
|
||||
const [nullable] = await eslint.lintText(
|
||||
"export const value: string | null = null;",
|
||||
{ filePath: "src/shared/api/problem-details.ts" },
|
||||
);
|
||||
|
||||
assert.equal(nullable.errorCount, 0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user