Skip to content

Commit

Permalink
ESLint v9 & Prettier v4
Browse files Browse the repository at this point in the history
  • Loading branch information
surol committed Oct 9, 2024
1 parent 80530d6 commit 850fb15
Show file tree
Hide file tree
Showing 115 changed files with 219 additions and 400 deletions.
30 changes: 0 additions & 30 deletions .eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion .prettierrc.cjs

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import configs from '@run-z/eslint-config';

export default configs;
15 changes: 5 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,17 @@
"devDependencies": {
"@jest/globals": "^29.7.0",
"@proc7ts/async": "^2.1.0",
"@run-z/eslint-config": "^4.2.0",
"@run-z/prettier-config": "^2.0.0",
"@run-z/eslint-config": "^5.0.0",
"@run-z/prettier-config": "^3.0.0",
"@run-z/project-config": "^0.20.4",
"@swc/core": "^1.7.26",
"@swc/jest": "^0.2.36",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"esgen": "^0.2.11",
"eslint": "^8.57.1",
"eslint-plugin-jest": "^28.8.3",
"eslint": "^9.12.0",
"expect": "^29.7.0",
"jest": "^29.7.0",
"jest-junit": "^16.0.0",
"jest-mock": "^29.7.0",
"prettier": "^2.8.8",
"prettier-eslint-cli": "^7.1.0",
"prettier": "^3.3.3",
"rollup": "^4.24.0",
"run-z": "^2.1.0",
"ts-jest": "^29.2.5",
Expand Down Expand Up @@ -125,7 +120,7 @@
"ci:all": "run-z all +test/--ci/--runInBand",
"clean": "run-z +z --then clean-z",
"doc": "run-z +z --then typedoc",
"format": "run-z +z --then prettier-eslint --write --include-dot-files \"src/**/*.*\" \"*.{js,cjs,json,md}\"",
"format": "run-z +z --then prettier --write \"src/**/*.*\" \"*.{js,cjs,json,md}\"",
"lint": "run-z +z --then eslint .",
"test": "run-z +z build env:NODE_OPTIONS=\"--experimental-vm-modules --no-warnings\" --then test-z",
"z": "run-z +cmd:build-z,+cmd:typedoc,+cmd:eslint"
Expand Down
3 changes: 3 additions & 0 deletions prettier.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from '@run-z/prettier-config';

export default config;
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { UccProcessor$FeatureSet } from './ucc-processor.feature-set.js';
export class UccProcessor$ConstraintApplication<
in out TBoot extends UccBootstrap<TBoot>,
in out TOptions,
> implements UccFeature.ConstraintApplication<TBoot, TOptions> {

> implements UccFeature.ConstraintApplication<TBoot, TOptions>
{
readonly #featureSet: UccProcessor$FeatureSet<TBoot>;
readonly #issue: UccProcessor$ConstraintIssue<TOptions>;
readonly #handle: UccFeature.Handle<TOptions>;
Expand Down Expand Up @@ -76,5 +76,4 @@ export class UccProcessor$ConstraintApplication<
this.#applied = -1;
}
}

}
2 changes: 0 additions & 2 deletions src/compiler/bootstrap/impl/ucc-processor.constraint-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { UccFeature } from '../ucc-feature.js';
import { UccProcessor$Current } from './ucc-processor.current.js';

export class UccProcessor$ConstraintIssue<out TOptions> implements UccProcessor$Current {

constructor(
readonly processor: UcProcessorName,
readonly entry: string | undefined,
Expand All @@ -25,7 +24,6 @@ export class UccProcessor$ConstraintIssue<out TOptions> implements UccProcessor$

return `import(${esStringLiteral(from)}).${esQuoteKey(use)}`;
}

}

export interface UccProcessor$ConstraintResolution<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { UccBootstrap } from '../ucc-bootstrap.js';
import { UccFeature } from '../ucc-feature.js';

export class UccProcessor$ConstraintMapper<in out TBoot extends UccBootstrap<TBoot>> {

readonly #handlers = new Map<string, UccFeature.ConstraintHandler<TBoot>>();

onConstraint<TOptions>(
Expand Down Expand Up @@ -48,5 +47,4 @@ export class UccProcessor$ConstraintMapper<in out TBoot extends UccBootstrap<TBo
): string {
return `${processor}(${within} ?? '*'):${use}@${from}`;
}

}
2 changes: 0 additions & 2 deletions src/compiler/bootstrap/impl/ucc-processor.constraint-usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export class UccProcessor$ConstraintUsage<
in out TBoot extends UccBootstrap<TBoot>,
in out TOptions = unknown,
> {

readonly #featureSet: UccProcessor$FeatureSet<TBoot>;
readonly #schema: UcSchema;
readonly #issues: UccProcessor$ConstraintIssue<TOptions>[] = [];
Expand Down Expand Up @@ -68,5 +67,4 @@ export class UccProcessor$ConstraintUsage<
}
});
}

}
2 changes: 0 additions & 2 deletions src/compiler/bootstrap/impl/ucc-processor.feature-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { UccProcessor$ConstraintMapper } from './ucc-processor.constraint-mapper
import { UccProcessor$Current } from './ucc-processor.current.js';

export class UccProcessor$FeatureSet<in out TBoot extends UccBootstrap<TBoot>> {

readonly #constraintMapper: UccProcessor$ConstraintMapper<TBoot>;
readonly #resolutions = new Map<string, Promise<{ [key in string]: UccFeature<TBoot> }>>();
readonly #enable: <TOptions>(
Expand Down Expand Up @@ -105,7 +104,6 @@ export class UccProcessor$FeatureSet<in out TBoot extends UccBootstrap<TBoot>> {
this.#current = prev;
}
}

}

interface UccFeature$Entry<in TOptions = never> {
Expand Down
2 changes: 0 additions & 2 deletions src/compiler/bootstrap/ucc-processor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ describe('UccProcessor', () => {
});

class UccTestProcessor extends UccProcessor<UccTestBootstrap> implements UccTestBootstrap {

readonly records: unknown[] = [];

record(value: unknown): void {
Expand All @@ -335,5 +334,4 @@ class UccTestProcessor extends UccProcessor<UccTestBootstrap> implements UccTest
protected override startBootstrap(): UccTestBootstrap {
return this;
}

}
13 changes: 7 additions & 6 deletions src/compiler/bootstrap/ucc-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { UccSchemaIndex } from './ucc-schema-index.js';
* @typeParam TBoot - Type of schema processing bootstrap.
*/
export abstract class UccProcessor<in out TBoot extends UccBootstrap<TBoot>>
implements UccBootstrap<TBoot> {

implements UccBootstrap<TBoot>
{
readonly #schemaIndex: UccSchemaIndex;
readonly #models: readonly [string, UcModel][] | undefined;
readonly #features: readonly UccFeature<TBoot, void>[] | undefined;
Expand All @@ -41,16 +41,18 @@ export abstract class UccProcessor<in out TBoot extends UccBootstrap<TBoot>>
asArray<UcPresentationName>(presentations),
);
this.#models =
models
&& Object.entries<UccProcessor.Entry | undefined>(models)
models &&
Object.entries<UccProcessor.Entry | undefined>(models)
.map(
([entryName, entry]): [string, UcModel] | undefined => entry && [entryName, entry.model],
)
.filter(isPresent);

this.#features = features && asArray(features);
this.#constraintMapper = new UccProcessor$ConstraintMapper<TBoot>();
this.#featureSet = new UccProcessor$FeatureSet(this.#constraintMapper, feature => this.handleFeature(feature));
this.#featureSet = new UccProcessor$FeatureSet(this.#constraintMapper, feature =>
this.handleFeature(feature),
);
this.#updateConstraints();
}

Expand Down Expand Up @@ -218,7 +220,6 @@ export abstract class UccProcessor<in out TBoot extends UccBootstrap<TBoot>>
): UccFeature.Handle<TOptions> | void {
return 'uccEnable' in feature ? feature.uccEnable(this.boot) : feature(this.boot);
}

}

export namespace UccProcessor {
Expand Down
8 changes: 4 additions & 4 deletions src/compiler/bootstrap/ucc-schema-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { UcDataType, UcSchema } from '../../schema/uc-schema.js';
import { ucSchemaVariant } from '../impl/uc-schema-variant.js';

export class UccSchemaIndex {

readonly #processors: readonly UcProcessorName[];
readonly #presentations: readonly UcPresentationName[];
readonly #types = new Map<string | UcDataType, UccSchemaIndex$TypeEntry>();
Expand Down Expand Up @@ -75,9 +74,11 @@ export class UccSchemaIndex {

#constraintsId(schema: UcSchema, constraints: UcConstraints = {}): string {
return this.processors
.map(processorName => asArray(constraints[processorName])
.map(processorName =>
asArray(constraints[processorName])
.map(feature => this.#featureConstraintId(schema, feature))
.join(''))
.join(''),
)
.join('');
}

Expand Down Expand Up @@ -119,7 +120,6 @@ export class UccSchemaIndex {

return entry;
}

}

interface UccSchemaIndex$TypeEntry {
Expand Down
6 changes: 2 additions & 4 deletions src/compiler/bootstrap/ucc-schema-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { UcSchema } from '../../schema/uc-schema.js';
import { UccSchemaIndex } from './ucc-schema-index.js';

export class UccSchemaMap<T> {

readonly #index: UccSchemaIndex;
readonly #map = new Map<string, T>();

Expand All @@ -13,8 +12,8 @@ export class UccSchemaMap<T> {

get(schema: UcSchema, within?: UcPresentationName): T | undefined {
return (
this.#map.get(this.#presentationId(schema, within))
?? (within && this.#map.get(this.#schemaId(schema)))
this.#map.get(this.#presentationId(schema, within)) ??
(within && this.#map.get(this.#schemaId(schema)))
);
}

Expand All @@ -29,5 +28,4 @@ export class UccSchemaMap<T> {
#schemaId(schema: UcSchema): string {
return `schema:${this.#index.schemaId(schema)}`;
}

}
2 changes: 0 additions & 2 deletions src/compiler/common/unsupported-uc-schema.error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ucModelName } from '../../schema/uc-model-name.js';
import { UcSchema } from '../../schema/uc-schema.js';

export class UnsupportedUcSchemaError extends TypeError {

readonly #schema: UcSchema;

constructor(
Expand All @@ -18,5 +17,4 @@ export class UnsupportedUcSchemaError extends TypeError {
get schema(): UcSchema {
return this.#schema;
}

}
2 changes: 0 additions & 2 deletions src/compiler/deserialization/bigint.ucrx.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { UcrxLib } from '../rx/ucrx-lib.js';
import { UcrxClass, UcrxSignature } from '../rx/ucrx.class.js';

export class BigIntUcrxClass extends UcrxClass<UcrxSignature.Args, UcBigInt, UcBigInt.Schema> {

static uccEnable<TBoot extends UcrxBootstrap<TBoot>>(
boot: TBoot,
): UccFeature.Handle<UcBigInt.Variant> {
Expand Down Expand Up @@ -85,5 +84,4 @@ export class BigIntUcrxClass extends UcrxClass<UcrxSignature.Args, UcBigInt, UcB
types.add('null');
}
}

}
2 changes: 0 additions & 2 deletions src/compiler/deserialization/boolean.ucrx.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { UcrxLib } from '../rx/ucrx-lib.js';
import { UcrxClass, UcrxSignature } from '../rx/ucrx.class.js';

export class BooleanUcrxClass extends UcrxClass<UcrxSignature.Args, UcBoolean, UcBoolean.Schema> {

static uccEnable<TBoot extends UcrxBootstrap<TBoot>>(boot: TBoot): void {
boot.useUcrxClass(Boolean, (lib, schema: UcBoolean.Schema) => new this(lib, schema));
}
Expand All @@ -33,5 +32,4 @@ export class BooleanUcrxClass extends UcrxClass<UcrxSignature.Args, UcBoolean, U
});
}
}

}
5 changes: 2 additions & 3 deletions src/compiler/deserialization/impl/uc-value.compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { UcdModels } from '../ucd-models.js';
export class UcValueCompiler extends UcdCompiler<{
parseUcValue: UcdModels.SyncEntry<UcUnknown.Schema>;
}> {

constructor() {
super({
models: {
Expand All @@ -35,7 +34,8 @@ export class UcValueCompiler extends UcdCompiler<{
declare: {
at: 'exports',
body:
({ args: { cx, attr } }) => (code, scope) => {
({ args: { cx, attr } }) =>
(code, scope) => {
const ucrxLib = scope.get(UcrxLib);
const ucrxClass = ucrxLib.ucrxClassFor(options.models.parseUcValue.model);

Expand All @@ -50,5 +50,4 @@ export class UcValueCompiler extends UcdCompiler<{
onMeta,
};
}

}
2 changes: 0 additions & 2 deletions src/compiler/deserialization/impl/ucd-handler-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { UC_MODULE_DESERIALIZER_DEFAULTS } from '../../impl/uc-modules.js';
import { UcdHandlerFeature } from '../ucd-handler-feature.js';

export class UcdHandlerRegistry {

readonly #requestedName: string;
#defaults: UcdHandlerConfig[] | undefined;
#custom: UcdHandlerConfig[] | undefined = [];
Expand Down Expand Up @@ -87,7 +86,6 @@ export class UcdHandlerRegistry {
});
};
}

}

interface UcdHandlerConfig {
Expand Down
Loading

0 comments on commit 850fb15

Please sign in to comment.