-
-
Notifications
You must be signed in to change notification settings - Fork 2
fix(deps): update dependency prettier-plugin-astro to v0.14.1 - abandoned #182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,9 +2,7 @@ import { GLOB_PACKAGEJSON, GLOB_TESTS, GLOB_TSCONFIG } from "../globs"; | |||||
| import type { MaybeArray, Options, TypedFlatConfigItem } from "../types"; | ||||||
| import { interopDefault } from "../utils"; | ||||||
|
|
||||||
| export async function formatting( | ||||||
| options?: Options, | ||||||
| ): Promise<TypedFlatConfigItem[]> { | ||||||
| export async function formatting(options?: Options): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maintain type specificity in the function return type. Changing the return type from Apply this diff to maintain type specificity: -export async function formatting(options?: Options): Promise {
+export async function formatting(options?: Options): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const pluginStylistic = await interopDefault( | ||||||
| import("@stylistic/eslint-plugin"), | ||||||
| ); | ||||||
|
|
@@ -181,7 +179,7 @@ export async function formatting( | |||||
| "jest-formatting/padding-around-all": "error", | ||||||
| }, | ||||||
| }, | ||||||
| ] satisfies (MaybeArray<TypedFlatConfigItem> | boolean)[] | ||||||
| ] satisfies (MaybeArray | boolean)[] | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maintain type specificity in type assertion. Changing the type assertion from Apply this diff to maintain type specificity: -] satisfies (MaybeArray | boolean)[]
+] satisfies (MaybeArray<TypedFlatConfigItem> | boolean)[]Committable suggestion
Suggested change
|
||||||
| ) | ||||||
| .flat() | ||||||
| .filter(Boolean) as any; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ import { GLOB_HTML } from "../globs"; | |||||
| import type { TypedFlatConfigItem } from "../types"; | ||||||
| import { interopDefault, renameRules } from "../utils"; | ||||||
|
|
||||||
| export async function html(): Promise<TypedFlatConfigItem[]> { | ||||||
| export async function html(): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Retain specific return type for better type safety and specificity. Changing the return type from Apply this diff to retain the specific return type: -export async function html(): Promise {
+export async function html(): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const parserHtml = await interopDefault(import("@html-eslint/parser")); | ||||||
| const pluginHtml = await interopDefault(import("@html-eslint/eslint-plugin")); | ||||||
| const pluginHtmlJsSupport = await interopDefault( | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,7 @@ import { GLOB_ESLINTRC, GLOB_JSON, GLOB_JSON5, GLOB_JSONC } from "../globs"; | |||||
| import type { TypedFlatConfigItem } from "../types"; | ||||||
| import { interopDefault } from "../utils"; | ||||||
|
|
||||||
| export async function jsonc(): Promise<TypedFlatConfigItem[]> { | ||||||
| export async function jsonc(): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert to the more specific return type for better type safety. The original return type Apply this diff to revert the return type: -export async function jsonc(): Promise {
+export async function jsonc(): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const parserJsonc = await interopDefault(import("jsonc-eslint-parser")); | ||||||
| const pluginJsonc = await interopDefault(import("eslint-plugin-jsonc")); | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,9 +9,7 @@ import { interopDefault } from "../utils"; | |||||
| export async function mdx({ | ||||||
| componentExts = [], | ||||||
| overrides, | ||||||
| }: OptionsComponentExts & OptionsOverrides = {}): Promise< | ||||||
| TypedFlatConfigItem[] | ||||||
| > { | ||||||
| }: OptionsComponentExts & OptionsOverrides = {}): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Retain specific return type for better type safety and specificity. Changing the return type from Apply this diff to retain the specific return type: }: OptionsComponentExts & OptionsOverrides = {}): Promise {
}: OptionsComponentExts & OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const pluginMdx = await interopDefault(import("eslint-plugin-mdx")); | ||||||
|
|
||||||
| return [ | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -9,9 +9,7 @@ import { interopDefault } from "../utils"; | |||||
| export async function solid({ | ||||||
| overrides, | ||||||
| typescript, | ||||||
| }: OptionsHasTypeScript & OptionsOverrides = {}): Promise< | ||||||
| TypedFlatConfigItem[] | ||||||
| > { | ||||||
| }: OptionsHasTypeScript & OptionsOverrides = {}): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the return type change. The function still returns an array of configuration objects, so the original return type Apply this diff to revert the return type change: -export async function solid({ overrides, typescript }: OptionsHasTypeScript & OptionsOverrides = {}): Promise {
+export async function solid({ overrides, typescript }: OptionsHasTypeScript & OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const pluginSolid = await interopDefault(import("eslint-plugin-solid")); | ||||||
|
|
||||||
| return [ | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,9 +2,7 @@ import { GLOB_TESTS } from "../globs"; | |||||
| import type { OptionsOverrides, TypedFlatConfigItem } from "../types"; | ||||||
| import { interopDefault } from "../utils"; | ||||||
|
|
||||||
| export async function test({ overrides }: OptionsOverrides = {}): Promise< | ||||||
| TypedFlatConfigItem[] | ||||||
| > { | ||||||
| export async function test({ overrides }: OptionsOverrides = {}): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the return type change to maintain type safety and clarity. The return type of the function -export async function test({ overrides }: OptionsOverrides = {}): Promise {
+export async function test({ overrides }: OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const pluginNoOnlyTests = await interopDefault( | ||||||
| // @ts-expect-error No declaration | ||||||
| import("eslint-plugin-no-only-tests"), | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,9 +2,7 @@ import { GLOB_TOML } from "../globs"; | |||||
| import type { OptionsOverrides, TypedFlatConfigItem } from "../types"; | ||||||
| import { interopDefault } from "../utils"; | ||||||
|
|
||||||
| export async function toml({ overrides }: OptionsOverrides = {}): Promise< | ||||||
| TypedFlatConfigItem[] | ||||||
| > { | ||||||
| export async function toml({ overrides }: OptionsOverrides = {}): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the return type change. The function still returns an array of configuration objects, so the original return type Apply this diff to revert the return type change: -export async function toml({ overrides }: OptionsOverrides = {}): Promise {
+export async function toml({ overrides }: OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const parserToml = await interopDefault(import("toml-eslint-parser")); | ||||||
| const pluginToml = await interopDefault(import("eslint-plugin-toml")); | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,7 +17,7 @@ export async function typescript({ | |
| overrides, | ||
| }: OptionsTypeScriptParserOptions & | ||
| OptionsComponentExts & | ||
| OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> { | ||
| OptionsOverrides = {}): Promise { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maintain type specificity in the function return type. Changing the return type from Apply this diff to maintain type specificity: OptionsOverrides = {}): Promise {
+ OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {
|
||
| const typeAwareRules: Rules = { | ||
| "no-throw-literal": "off", | ||
| "ts/no-throw-literal": "error", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,9 +11,7 @@ import { interopDefault } from "../utils"; | |
| export async function vue({ | ||
| overrides, | ||
| typescript, | ||
| }: OptionsHasTypeScript & OptionsOverrides = {}): Promise< | ||
| TypedFlatConfigItem[] | ||
| > { | ||
| }: OptionsHasTypeScript & OptionsOverrides = {}): Promise { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maintain type specificity in the function return type. Changing the return type from Apply this diff to maintain type specificity: }: OptionsHasTypeScript & OptionsOverrides = {}): Promise {
+}: OptionsHasTypeScript & OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {
|
||
| const parserVue = await interopDefault(import("vue-eslint-parser")); | ||
| // @ts-expect-error No declaration | ||
| const pluginVue = await interopDefault(import("eslint-plugin-vue")); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2,9 +2,7 @@ import { GLOB_YAML } from "../globs"; | |||||
| import type { OptionsOverrides, TypedFlatConfigItem } from "../types"; | ||||||
| import { interopDefault, renameRules } from "../utils"; | ||||||
|
|
||||||
| export async function yaml({ overrides }: OptionsOverrides = {}): Promise< | ||||||
| TypedFlatConfigItem[] | ||||||
| > { | ||||||
| export async function yaml({ overrides }: OptionsOverrides = {}): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the return type change. The function still returns an array of configuration objects, so the original return type Apply this diff to revert the return type change: -export async function yaml({ overrides }: OptionsOverrides = {}): Promise {
+export async function yaml({ overrides }: OptionsOverrides = {}): Promise<TypedFlatConfigItem[]> {Committable suggestion
Suggested change
|
||||||
| const parserYaml = await interopDefault(import("yaml-eslint-parser")); | ||||||
| const pluginYaml = await interopDefault(import("eslint-plugin-yml")); | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -60,7 +60,7 @@ export const defaultPluginRenaming = { | |
| */ | ||
| export function so1ve( | ||
| options: Options & TypedFlatConfigItem = {}, | ||
| ...userConfigs: MaybeArray<TypedFlatConfigItem>[] | ||
| ...userConfigs: MaybeArray[] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the parameter and variable type changes to maintain type safety and specificity. The parameter type for ...userConfigs: MaybeArray[]
...userConfigs: MaybeArray<TypedFlatConfigItem>[]
const configs: MaybePromise[]
const configs: MaybePromise<TypedFlatConfigItem[]>[]Also applies to: 73-73 |
||
| ) { | ||
| const { | ||
| vue: enableVue = VuePackages.some((i) => isPackageExists(i)), | ||
|
|
@@ -70,7 +70,7 @@ export function so1ve( | |
| componentExts = [], | ||
| } = options; | ||
|
|
||
| const configs: MaybePromise<TypedFlatConfigItem[]>[] = []; | ||
| const configs: MaybePromise[] = []; | ||
|
|
||
| if (enableGitignore) { | ||
| if (typeof enableGitignore === "boolean") { | ||
|
|
@@ -202,12 +202,12 @@ export function so1ve( | |
| return composer; | ||
| } | ||
|
|
||
| export type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>; | ||
| export type ResolvedOptions<T> = T extends boolean ? never : NonNullable; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the type change to maintain type specificity. The type -export type ResolvedOptions<T> = T extends boolean ? never : NonNullable;
+export type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
): ResolvedOptions =>
): ResolvedOptions<Options[K]> =>Also applies to: 210-210 |
||
|
|
||
| export const resolveSubOptions = <K extends keyof Options>( | ||
| options: Options & TypedFlatConfigItem, | ||
| key: K, | ||
| ): ResolvedOptions<Options[K]> => | ||
| ): ResolvedOptions => | ||
| typeof options[key] === "boolean" ? ({} as any) : options[key] || {}; | ||
|
|
||
| export function getOverrides<K extends keyof Options>( | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,15 +4,12 @@ import type { FlatGitignoreOptions } from "eslint-config-flat-gitignore"; | |||||
|
|
||||||
| import type { RuleOptions } from "./typegen"; | ||||||
|
|
||||||
| export type MaybePromise<T> = T | Promise<T>; | ||||||
| export type MaybePromise<T> = T | Promise; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the type change to maintain type safety and specificity. The type -export type MaybePromise<T> = T | Promise;
+export type MaybePromise<T> = T | Promise<T>;Committable suggestion
Suggested change
|
||||||
| export type MaybeArray<T> = T | T[]; | ||||||
|
|
||||||
| export type Rules = RuleOptions; | ||||||
|
|
||||||
| export type TypedFlatConfigItem = Omit< | ||||||
| Linter.FlatConfig<Linter.RulesRecord & Rules>, | ||||||
| "plugins" | ||||||
| > & { | ||||||
| export type TypedFlatConfigItem = Omit & { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the type change to maintain strict type checking. The type -export type TypedFlatConfigItem = Omit & {
+export type TypedFlatConfigItem = Omit<Linter.FlatConfig<Linter.RulesRecord & Rules>, "plugins"> & {
|
||||||
| // Relax plugins type limitation, as most of the plugins did not have correct type info yet. | ||||||
| /** | ||||||
| * An object containing a name-value mapping of plugin names to plugin | ||||||
|
|
@@ -21,7 +18,7 @@ export type TypedFlatConfigItem = Omit< | |||||
| * | ||||||
| * @see [Using plugins in your configuration](https://eslint.org/docs/latest/user-guide/configuring/configuration-files-new#using-plugins-in-your-configuration) | ||||||
| */ | ||||||
| plugins?: Record<string, any>; | ||||||
| plugins?: Record; | ||||||
| }; | ||||||
|
|
||||||
| export interface OptionsComponentExts { | ||||||
|
|
@@ -35,7 +32,7 @@ export interface OptionsTypeScriptParserOptions { | |||||
| /** | ||||||
| * Additional parser options for TypeScript. | ||||||
| */ | ||||||
| parserOptions?: Partial<ParserOptions>; | ||||||
| parserOptions?: Partial; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert the type change to maintain type specificity. The -parserOptions?: Partial;
+parserOptions?: Partial<ParserOptions>;Committable suggestion
Suggested change
|
||||||
| } | ||||||
|
|
||||||
| export interface OptionsHasTypeScript { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,10 +20,7 @@ import type { MaybePromise } from "./types"; | |||||
| * ]; | ||||||
| * ``` | ||||||
| */ | ||||||
| export const renameRules = ( | ||||||
| rules: Record<string, any>, | ||||||
| map: Record<string, string>, | ||||||
| ) => | ||||||
| export const renameRules = (rules: Record, map: Record) => | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert to the more specific parameter types for better type safety. The original parameter types Apply this diff to revert the parameter types: -export const renameRules = (rules: Record, map: Record) =>
+export const renameRules = (rules: Record<string, any>, map: Record<string, string>) =>Committable suggestion
Suggested change
|
||||||
| Object.fromEntries( | ||||||
| Object.entries(rules).map(([key, value]) => { | ||||||
| for (const [from, to] of Object.entries(map)) { | ||||||
|
|
@@ -36,9 +33,7 @@ export const renameRules = ( | |||||
| }), | ||||||
| ); | ||||||
|
|
||||||
| export async function interopDefault<T>( | ||||||
| m: MaybePromise<T>, | ||||||
| ): Promise<T extends { default: infer U } ? U : T> { | ||||||
| export async function interopDefault<T>(m: MaybePromise): Promise { | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert to the more specific return type for better type safety. The original return type Apply this diff to revert the return type: -export async function interopDefault<T>(m: MaybePromise): Promise {
+export async function interopDefault<T>(m: MaybePromise<T>): Promise<T extends { default: infer U } ? U : T> {Committable suggestion
Suggested change
|
||||||
| const resolved = await m; | ||||||
|
|
||||||
| return (resolved as any).default || resolved; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -44,4 +44,4 @@ export default { | |||||
| jsdocPreferCodeFences: true, | ||||||
| jsdocCommentLineStrategy: "multiline", | ||||||
| tsdoc: true, | ||||||
| } satisfies Config & Record<string, unknown>; | ||||||
| } satisfies Config & Record; | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Revert to the more specific type assertion for better type safety. The original type assertion Apply this diff to revert the type assertion: -} satisfies Config & Record;
+} satisfies Config & Record<string, unknown>;Committable suggestion
Suggested change
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Retain specific input and return types for better type safety and specificity.
Changing the input and return types to more generic types reduces type safety and specificity. It is recommended to retain the specific input and return types to ensure the expected input and output structure and prevent potential type-related errors in the consuming code.
Apply this diff to retain the specific input and return types:
Committable suggestion