Skip to content

Commit

Permalink
#80 made eslint work in vscode microsoft/vscode-eslint#1823 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
bennobuilder committed Nov 28, 2024
1 parent f351b42 commit 72282ca
Show file tree
Hide file tree
Showing 37 changed files with 49 additions and 51 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The structure of the `package.json` file in this project should adhere to a spec
"scripts": {
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"start:dev": "tsc -w",
"lint": "eslint",
"lint": "eslint . --fix",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"build": "shx rm -rf dist && tsc",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"start:dev": "tsc -w",
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
2 changes: 1 addition & 1 deletion packages/elevenlabs-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"openapi:generate": "npx openapi-typescript ./resources/openapi_v1-0-0.json -o ./src/gen/v1.ts",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
Expand Down
2 changes: 1 addition & 1 deletion packages/elevenlabs-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/method-signature-style -- Ok here */
import { type FetchError, type TResult } from 'feature-fetch';
import { type TGenerateTextToSpeechConfig, type TVoiceResponse } from './types';

Expand Down
2 changes: 1 addition & 1 deletion packages/eprel-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"openapi:generate": "npx openapi-typescript ./resources/openapi_v1-0-58.yaml -o ./src/gen/v1.ts",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
Expand Down
2 changes: 1 addition & 1 deletion packages/eprel-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/method-signature-style -- Ok here */
import { type FetchError, type TResult } from 'feature-fetch';
import type { components } from './gen/v1';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-fetch/src/create-fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function createFetchClient<GPaths extends object = object>(
// Process before request middlewares
try {
for (const middleware of this._config.beforeRequestMiddlewares) {
// eslint-disable-next-line no-await-in-loop -- Needs to be processed in order
await middleware({
path,
props: middlewareProps,
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-fetch/src/features/with-graphql/gql.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable no-param-reassign -- Ok in reduce function */

// https://github.com/apollographql/graphql-tag/blob/main/src/index.ts
export function gql(literals: TemplateStringsArray, ...args: unknown[]): string {
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-fetch/src/types/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type TFeatures<GPaths extends object = object> = {
} & TThirdPartyFeatures<GPaths>;

// Global registry for third party features
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Overwritten by third party libraries
export interface TThirdPartyFeatures<GPaths> {}

export type TFeatureKeys<GPaths extends object = object> = keyof TFeatures<GPaths>;
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-form/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-form/src/types/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type TFeatures<GFormData extends TFormData = TFormData> = {
} & TThirdPartyFeatures<GFormData>;

// Global registry for third party features
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Overwritten by third party libraries
export interface TThirdPartyFeatures<GFormData> {}

export type TFeatureKeys<GFormData extends TFormData = TFormData> = keyof TFeatures<GFormData>;
Expand Down
14 changes: 7 additions & 7 deletions packages/feature-form/src/types/form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ export interface TFormFieldStateConfig {
}

export enum FormFieldValidateMode {
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnBlur = 1 << 0, // 1
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnChange = 1 << 1, // 2
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnSubmit = 1 << 2, // 4
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnTouched = 1 << 3 // 8
}

export enum FormFieldReValidateMode {
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnBlur = 1 << 0, // 1
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnChange = 1 << 1, // 2
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member, no-bitwise -- ok here
// eslint-disable-next-line @typescript-eslint/prefer-literal-enum-member -- ok here
OnSubmit = 1 << 2 // 4
}

Expand Down
2 changes: 1 addition & 1 deletion packages/feature-logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-logger/src/types/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type TFeatures = {
} & TThirdPartyFeatures;

// Global registry for third party features
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Overwritten by third party libraries
export interface TThirdPartyFeatures {}

export type TFeatureKeys = keyof TFeatures;
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-react/src/state/hooks/use-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function useSelector<GValue, GPath extends TNestedPath<GValue>>(
const [, forceRender] = React.useReducer((s: number) => s + 1, 0);

React.useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -- Ok
const unbind = state.listenToSelected(
[selectedProperty],
({ background }) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-state/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/feature-state/src/types/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export type TFeatures<GValue = unknown> = {
} & TThirdPartyFeatures<GValue>;

// Global registry for third party features
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Overwritten by third party libraries
export interface TThirdPartyFeatures<GValue> {}

export type TFeatureKeys<GValue = unknown> = keyof TFeatures<GValue>;
Expand Down
2 changes: 1 addition & 1 deletion packages/figma-connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/google-webfonts-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"openapi:generate": "npx openapi-typescript ./resources/openapi-v1.yaml -o ./src/gen/v1.ts",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
Expand Down
2 changes: 1 addition & 1 deletion packages/google-webfonts-client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable @typescript-eslint/method-signature-style -- Ok here */
import type { FetchError, TFetchClient, TResult } from 'feature-fetch';
import type { components } from './gen/v1';
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function validationMiddleware<GPathOperation>(
): express.RequestHandler {
const { bodyValidator, pathValidator, queryValidator } = validators;

// eslint-disable-next-line @typescript-eslint/no-misused-promises -- async callback
return async (req, _res, next) => {
try {
const validationErrors: TValidationError[] = [];
Expand Down Expand Up @@ -149,10 +149,10 @@ function validationMiddleware<GPathOperation>(
}

function requestHandler(handler: express.RequestHandler): express.RequestHandler {
// eslint-disable-next-line @typescript-eslint/no-misused-promises -- async callback
return async (req, res, next) => {
try {
// eslint-disable-next-line @typescript-eslint/await-thenable, @typescript-eslint/no-confusing-void-expression -- RequestHandler can be async
await handler(req, res, next);
} catch (error) {
next(error);
Expand Down
2 changes: 1 addition & 1 deletion packages/openapi-router/src/types/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type TFeatures<GPaths extends object = object> = {
} & TThirdPartyFeatures<GPaths>;

// Global registry for third party features
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Overwritten by third party libraries
export interface TThirdPartyFeatures<GPaths> {}

export type TFeatureKeys<GPaths extends object = object> = keyof TFeatures<GPaths>;
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"build": "shx rm -rf dist && ../../scripts/cli.sh bundle -b typesonly",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"update:latest": "pnpm update --latest"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 0 additions & 2 deletions packages/utils/src/BitwiseFlag.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-bitwise -- Based on bit*/

export class BitwiseFlag<T extends number> {
private value: number;

Expand Down
6 changes: 3 additions & 3 deletions packages/utils/src/hex-to-rgb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export function hexToRgb(hex: THexColor): TRgbColor | null {
const hexValue = hex.slice(1);
if (hexValue.length === 3) {
// @ts-expect-error -- Covered by above regex check
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands -- Covered by above regex check
r = parseInt(hexValue[0] + hexValue[0], 16);
// @ts-expect-error -- Covered by above regex check
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands -- Covered by above regex check
g = parseInt(hexValue[1] + hexValue[1], 16);
// @ts-expect-error -- Covered by above regex check
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands -- Covered by above regex check
b = parseInt(hexValue[2] + hexValue[2], 16);
} else {
r = parseInt(hexValue.slice(0, 2), 16);
Expand Down
4 changes: 2 additions & 2 deletions packages/utils/src/is-object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ describe('isObject function', () => {
});

it('should return false for functions', () => {
// eslint-disable-next-line func-names, @typescript-eslint/no-empty-function -- Test
expect(isObject(function () {})).toBeFalsy();
// eslint-disable-next-line @typescript-eslint/no-empty-function -- Test
expect(isObject(() => {})).toBeFalsy();
});
});
2 changes: 1 addition & 1 deletion packages/utils/src/json-function.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function toFunction(jsonFunction: TJsonFunction): Function {
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func -- .
return new Function(...jsonFunction.args, jsonFunction.body);
}

Expand Down
6 changes: 3 additions & 3 deletions packages/utils/src/to-hex.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable camelcase -- Constants*/

// Pre-Init (constants are precomputed for performance reasons)
const LUT_HEX_4b = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'];
const LUT_HEX_8b = new Array(0x100).fill('');

// Populate the lookup table for hex values
for (let n = 0; n < 0x100; n++) {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, no-bitwise -- Ok here
LUT_HEX_8b[n] = `${LUT_HEX_4b[(n >>> 4) & 0xf]}${LUT_HEX_4b[n & 0xf]}`;
}

Expand All @@ -26,7 +26,7 @@ export function toHex(buffer: Uint8Array | Buffer): string {
let out = '';
for (let idx = 0, len = buffer.length; idx < len; idx++) {
// @ts-expect-error - buffer can't be undefined because we check length in for loop
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands -- Ok here
out += LUT_HEX_8b[buffer[idx]];
}

Expand Down
2 changes: 1 addition & 1 deletion packages/validation-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/validation-adapter/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type TValidateCallback<

export interface TBaseValidationContext<GValue> {
config: TValidationContextConfig;
// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents -- ok here
value: Readonly<GValue | unknown>;
hasError: () => boolean;
isValue: (value: unknown) => value is GValue; // NOTE: We have to define a property using explicitly GValue to enforce generic. See: https://stackoverflow.com/questions/78716973/enforcing-same-generic-types-in-typescript/78717389
Expand Down
2 changes: 1 addition & 1 deletion packages/validation-adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"build": "shx rm -rf dist && chmod +x ../../scripts/cli.sh && ../../scripts/cli.sh bundle",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
2 changes: 1 addition & 1 deletion packages/xml-tokenizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"build:dev": "shx rm -rf dist && ../../scripts/cli.sh bundle --target=dev",
"clean": "shx rm -rf dist && shx rm -rf node_modules && shx rm -rf .turbo",
"install:clean": "pnpm run clean && pnpm install",
"lint": "eslint",
"lint": "eslint . --fix",
"publish:patch": "pnpm build && pnpm version patch && pnpm publish --no-git-checks --access=public",
"size": "size-limit --why",
"start:dev": "tsc -w",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void describe('xml to object', () => {
});

bench('[xml-tokenizer (dist)]', () => {
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression -- Javascript module
const result = xtDist.xmlToObject(xml);
expect(result).not.toBeNull();
});
Expand Down

0 comments on commit 72282ca

Please sign in to comment.