Skip to content

Commit 87c179a

Browse files
JoshuaKGoldbergflorian-lefebvremartrapp
authored
chore: bump @typescript-eslint/no-unused-vars to error internally (#11173)
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev> Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com>
1 parent 536209a commit 87c179a

18 files changed

Lines changed: 25 additions & 64 deletions

File tree

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default [
6262
// These off/configured-differently-by-default rules fit well for us
6363
'@typescript-eslint/switch-exhaustiveness-check': 'error',
6464
'@typescript-eslint/no-unused-vars': [
65-
'warn',
65+
'error',
6666
{
6767
argsIgnorePattern: '^_',
6868
varsIgnorePattern: '^_',

packages/astro/e2e/view-transitions.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ test.describe('View Transitions', () => {
169169

170170
test('Moving from a page without ViewTransitions w/ back button', async ({ page, astro }) => {
171171
const loads = collectLoads(page);
172-
173172
// Go to page 1
174173
await page.goto(astro.resolveUrl('/one'));
175174
let p = page.locator('#one');
@@ -184,6 +183,10 @@ test.describe('View Transitions', () => {
184183
await page.goBack();
185184
p = page.locator('#one');
186185
await expect(p, 'should have content').toHaveText('Page 1');
186+
expect(
187+
loads.length,
188+
'There should be 3 page loads (for page one & three), and an additional loads for the back navigation'
189+
).toEqual(3);
187190
});
188191

189192
test('Stylesheets in the head are waited on', async ({ page, astro }) => {

packages/astro/src/@types/astro.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ import type {
5050
TransitionBeforePreparationEvent,
5151
TransitionBeforeSwapEvent,
5252
} from '../transitions/events.js';
53-
import type { DeepPartial, OmitIndexSignature, Simplify, WithRequired } from '../type-utils.js';
53+
import type { DeepPartial, OmitIndexSignature, Simplify } from '../type-utils.js';
5454
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
5555

5656
export type { AstroIntegrationLogger, ToolbarServerHelpers };

packages/astro/src/actions/runtime/virtual/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ export type ActionClient<
3333
input: TAccept extends 'form' ? FormData : z.input<TInputSchema>
3434
) => Promise<
3535
SafeResult<
36-
z.input<TInputSchema> extends ErrorInferenceObject
37-
? z.input<TInputSchema>
38-
: ErrorInferenceObject,
39-
Awaited<TOutput>
36+
z.input<TInputSchema> extends ErrorInferenceObject
37+
? z.input<TInputSchema>
38+
: ErrorInferenceObject,
39+
Awaited<TOutput>
4040
>
4141
>;
4242
}

packages/astro/src/actions/runtime/virtual/shared.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ const statusToCodeMap: Record<number, ActionErrorCode> = Object.entries(codeToSt
4343
{}
4444
);
4545

46+
// T is used for error inference with SafeInput -> isInputError.
47+
// See: https://github.com/withastro/astro/pull/11173/files#r1622767246
48+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4649
export class ActionError<T extends ErrorInferenceObject = ErrorInferenceObject> extends Error {
4750
type = 'AstroActionError';
4851
code: ActionErrorCode = 'INTERNAL_SERVER_ERROR';

packages/astro/src/content/vite-plugin-content-assets.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { extname } from 'node:path';
22
import { pathToFileURL } from 'node:url';
3-
import type { Plugin, Rollup } from 'vite';
3+
import type { Plugin } from 'vite';
44
import type { AstroSettings, SSRElement } from '../@types/astro.js';
55
import { getAssetsPrefix } from '../assets/utils/getAssetsPrefix.js';
66
import type { BuildInternals } from '../core/build/internal.js';
@@ -129,22 +129,9 @@ export function astroConfigBuildPlugin(
129129
options: StaticBuildOptions,
130130
internals: BuildInternals
131131
): AstroBuildPlugin {
132-
let ssrPluginContext: Rollup.PluginContext | undefined = undefined;
133132
return {
134133
targets: ['server'],
135134
hooks: {
136-
'build:before': ({ target }) => {
137-
return {
138-
vitePlugin: {
139-
name: 'astro:content-build-plugin',
140-
generateBundle() {
141-
if (target === 'server') {
142-
ssrPluginContext = this;
143-
}
144-
},
145-
},
146-
};
147-
},
148135
'build:post': ({ ssrOutputs, clientOutputs, mutate }) => {
149136
const outputs = ssrOutputs.flatMap((o) => o.output);
150137
const prependBase = (src: string) => {
@@ -232,8 +219,6 @@ export function astroConfigBuildPlugin(
232219
mutate(chunk, ['server'], newCode);
233220
}
234221
}
235-
236-
ssrPluginContext = undefined;
237222
},
238223
},
239224
};

packages/astro/src/core/build/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ async function generatePage(
199199
pipeline: BuildPipeline
200200
) {
201201
// prepare information we need
202-
const { config, internals, logger } = pipeline;
202+
const { config, logger } = pipeline;
203203
const pageModulePromise = ssrEntry.page;
204204

205205
// Calculate information of the page, like scripts, links and styles

packages/astro/src/core/build/pipeline.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type {
88
import { getOutputDirectory } from '../../prerender/utils.js';
99
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
1010
import type { SSRManifest } from '../app/types.js';
11-
import { DEFAULT_404_COMPONENT } from '../constants.js';
1211
import { routeIsFallback, routeIsRedirect } from '../redirects/helpers.js';
1312
import { RedirectSinglePageBuiltModule } from '../redirects/index.js';
1413
import { Pipeline } from '../render/index.js';

packages/astro/src/env/runtime.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { ValidationResultInvalid } from './validators.js';
44
export { validateEnvVariable, getEnvFieldType } from './validators.js';
55

66
export type GetEnv = (key: string) => string | undefined;
7+
type OnSetGetEnv = (reset: boolean) => void
78

89
let _getEnv: GetEnv = (key) => process.env[key];
910

@@ -13,9 +14,9 @@ export function setGetEnv(fn: GetEnv, reset = false) {
1314
_onSetGetEnv(reset);
1415
}
1516

16-
let _onSetGetEnv = (reset: boolean) => {};
17+
let _onSetGetEnv: OnSetGetEnv = () => {};
1718

18-
export function setOnSetGetEnv(fn: typeof _onSetGetEnv) {
19+
export function setOnSetGetEnv(fn: OnSetGetEnv) {
1920
_onSetGetEnv = fn;
2021
}
2122

packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,6 @@ const a11y_required_content = [
126126

127127
const a11y_distracting_elements = ['blink', 'marquee'];
128128

129-
// Unused for now
130-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
131-
const a11y_nested_implicit_semantics = new Map([
132-
['header', 'banner'],
133-
['footer', 'contentinfo'],
134-
]);
135129
const a11y_implicit_semantics = new Map([
136130
['a', 'link'],
137131
['area', 'link'],
@@ -624,19 +618,6 @@ export const a11y: AuditRuleWithSelector[] = [
624618
},
625619
];
626620

627-
// Unused for now
628-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
629-
const a11y_labelable = [
630-
'button',
631-
'input',
632-
'keygen',
633-
'meter',
634-
'output',
635-
'progress',
636-
'select',
637-
'textarea',
638-
];
639-
640621
/**
641622
* Exceptions to the rule which follows common A11y conventions
642623
* TODO make this configurable by the user

0 commit comments

Comments
 (0)