Skip to content

Commit

Permalink
fix: ci lint
Browse files Browse the repository at this point in the history
  • Loading branch information
0x706b committed Jul 21, 2024
1 parent b14549f commit 645ad87
Show file tree
Hide file tree
Showing 27 changed files with 59 additions and 159 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 22.x
cache: yarn
- name: Install
run: |
npm install -g yarn
npm install --location=global yarn
corepack enable
yarn install --immutable
- name: Lint
run: |
yarn workspace @fncts/codegen build && yarn workspace @fncts/codegen build-cjs
yarn build-lint-deps
yarn lint
- name: Build
run: |
Expand Down
2 changes: 0 additions & 2 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
compressionLevel: mixed

enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.3.1.cjs
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
"changeset": "changeset",
"release": "changeset publish",
"build": "tsc -b --verbose",
"build-pack": "yarn build && ultra -r build-pack",
"format": "ultra -r format",
"clean": "ultra -r clean",
"build-pack": "yarn build && yarn workspaces foreach -Atp run build-pack",
"format": "yarn workspaces foreach -Atp run format",
"clean": "yarn workspaces foreach -Atp run clean",
"test": "yarn build && yarn vitest",
"test:watch": "yarn org:concurrently 'yarn build --watch' 'yarn org:vitest --watch'",
"lint": "ultra -r lint",
"build-lint-deps": "yarn workspaces foreach -Rp --topological-dev --from @fncts/codegen run build-pack",
"lint": "yarn workspaces foreach -Atp run lint",
"circular": "madge --ts-config ./tsconfig.madge.json --circular --warning packages/*/build/esm",
"postinstall": "tsplus-install",
"org:eslint": "cd $INIT_CWD && eslint",
Expand Down Expand Up @@ -64,7 +65,6 @@
"prettier-eslint-cli": "^8.0.1",
"typescript": "5.5.3",
"typescript-eslint": "^7.14.1",
"ultra-runner": "^3.10.5",
"vitest": "^1.3.1"
}
}
5 changes: 4 additions & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"directory": "dist"
},
"exports": {
"./*": "./build/esm/*.js"
"./*": {
"import": "./build/esm/*.js",
"require": "./build/cjs/*.cjs"
}
},
"scripts": {
"build": "yarn org:tsc -b ./tsconfig.json",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function substractArrayIntToNew(arrayIntA: ArrayInt, arrayIntB: ArrayInt)
export function trimArrayIntInplace(arrayInt: ArrayInt) {
const data = arrayInt.data;
let firstNonZero = 0;

for (; firstNonZero !== data.length && data[firstNonZero] === 0; ++firstNonZero) {}
if (firstNonZero === data.length) {
// only zeros
Expand Down
1 change: 1 addition & 0 deletions packages/codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@0x706b/eslint-plugin-align-assignments": "^0.1.2",
"@babel/generator": "^7.23.6",
"@babel/parser": "^7.24.0",
"@fncts/scripts": "workspace:*",
"@types/babel__generator": "^7.6.8",
"@types/benchmark": "^2.1.5",
"@types/glob": "^8.1.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/codegen/src/barrel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// to add the `.js` extension to exports

import type { Preset } from "./codegen";
import type {} from "@fncts/base/global";
import type {} from "./internal/Array.js";

import generate from "@babel/generator";
import { parse } from "@babel/parser";
import { match, P } from "@fncts/pattern";
import * as glob from "glob";
import camelCase from "lodash/camelCase";
import * as path from "path";
import { match, P } from "ts-pattern";

/**
* Bundle several modules into a single convenient one.
Expand Down Expand Up @@ -55,7 +55,7 @@ const barrel: Preset<{
continue;
}
p = `./${p}`.replace(/(\.\/)+\./g, ".");
if ([".js", ".mjs", ".ts", ".tsx"].includes(path.extname(p))) {
if (![".js", ".mjs", ".ts", ".tsx"].includes(path.extname(p))) {
continue;
}
p = p.replace(/\.\w+$/, "") + ".js";
Expand Down Expand Up @@ -98,7 +98,7 @@ const barrel: Preset<{
)
.otherwise(() => withIdentifiers.map((i) => i.identifier));

const exportPrefix = opts.export?.match
const exportPrefix = match(opts.export)
.with(undefined, () => "export")
.with("default", () => "export default")
.with({ name: "default" }, () => "export default")
Expand Down
22 changes: 22 additions & 0 deletions packages/codegen/src/internal/Array.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
declare global {
/** @tsplus type fncts.ReadonlyArray */
export interface ReadonlyArray<T> {}
/** @tsplus type fncts.Array */
export interface Array<T> {}
}

/**
* @tsplus pipeable fncts.Array groupBy
* @tsplus pipeable fncts.ReadonlyArray groupBy
*/
export function groupBy<A, K extends PropertyKey>(f: (a: A) => K) {
return (self: ReadonlyArray<A>): Record<K, ReadonlyArray<A>> => {
const out = {} as Record<K, Array<A>>;
for (let i = 0; i < self.length; i++) {
const a = self[i]!;
const k = f(a);
(out[k] ??= []).push(a);
}
return out;
};
}
2 changes: 1 addition & 1 deletion packages/codegen/src/type-barrel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const typeBarrel: Preset<{
continue;
}
p = `./${p}`.replace(/(\.\/)+\./g, ".");
if ([".js", ".mjs", ".ts", ".tsx"].includes(path.extname(p))) {
if (![".js", ".mjs", ".ts", ".tsx"].includes(path.extname(p))) {
continue;
}
p = p.replace(/\.\w+$/, "") + ".js";
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.6.0",
"@fncts/config": "workspace:*",
"@fncts/scripts": "workspace:*",
"@types/eslint__js": "^8.42.3",
"typescript-eslint": "^7.14.1"
},
Expand Down
1 change: 0 additions & 1 deletion packages/io/src/Channel/UpstreamPullStrategy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// codegen:start { preset: barrel, include: ./UpstreamPullStrategy/*.ts }
export * from "./UpstreamPullStrategy/definition.js";
// codegen:end
1 change: 0 additions & 1 deletion packages/io/src/Channel/api/runScoped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function runScopedInterpret<Env, InErr, InDone, OutErr, OutDone>(
return channelState.effect.flatMap(() => runScopedInterpret(exec.run(), exec));
}
case ChannelStateTag.Emit: {

channelState = exec.run();
break;
}
Expand Down
1 change: 0 additions & 1 deletion packages/io/src/Hub/internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ export class BackPressure<A> extends Strategy<A> {
}

get shutdown(): UIO<void> {

const self = this;
return Do((_) => {
const fiberId = _(IO.fiberId);
Expand Down
1 change: 0 additions & 1 deletion packages/io/src/Layer/MemoMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export class MemoMap {
* and adds a finalizer to the outer `Managed`.
*/
getOrElseMemoize = <R, E, A>(scope: Scope, layer: Layer<R, E, A>, __tsplusTrace?: string) => {

return this.ref.modifyIO((map) => {
const inMap = map.get(layer[LayerHash]);

Expand Down
2 changes: 0 additions & 2 deletions packages/io/src/Queue/strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ export class BackPressureStrategy<A> implements Strategy<A> {
unsafeOffer(as: Conc<A>, p: Future<never, boolean>, __tsplusTrace?: string) {
let bs = as;
while (bs.length > 0) {

const head = bs.unsafeGet(0);
bs = bs.drop(1);
if (bs.length === 0) {
Expand Down Expand Up @@ -90,7 +89,6 @@ export class BackPressureStrategy<A> implements Strategy<A> {
}

get shutdown(): UIO<void> {

const self = this;
return Do((_) => {
const fiberId = _(IO.fiberId);
Expand Down
2 changes: 1 addition & 1 deletion packages/io/src/STM/internal/Journal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function suspendTryCommit<R, E, A>(
for (const entry of untracked) {
accum.set(entry[0], entry[1]);
}

journal = untracked;
}
break;
Expand Down
1 change: 0 additions & 1 deletion packages/io/src/Scope/Finalizer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// codegen:start { preset: barrel, include: Finalizer/*.ts }
export * from "./Finalizer/definition.js";
// codegen:end
8 changes: 6 additions & 2 deletions packages/pattern/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
"directory": "dist"
},
"exports": {
"./*": "./build/esm/*.js"
"./*": {
"import": "./build/esm/*.js",
"require": "./build/cjs/*.cjs"
}
},
"scripts": {
"build": "yarn org:tsc -b ./tsconfig.json",
Expand All @@ -33,6 +36,7 @@
"devDependencies": {
"@fncts/config": "workspace:*",
"@fncts/eslint-config": "workspace:*",
"@fncts/scripts": "workspace:*"
"@fncts/scripts": "workspace:*",
"@fncts/transformers": "workspace:*"
}
}
1 change: 0 additions & 1 deletion packages/query/src/DataSource/definition.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { Conc } from "@fncts/base/collection/immutable/Conc";
import { IO } from "@fncts/io/IO";
import { CompletedRequestMap } from "@fncts/query/CompletedRequestMap";
Expand Down
3 changes: 1 addition & 2 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
},
"scripts": {
"build": "yarn org:tsc -b ./tsconfig.json",
"build-pack": "yarn build",
"lint": "yarn org:eslint src/**/*.ts",
"format": "yarn org:prettier --list-different -w src/**/*.ts",
"circular": "yarn org:madge --circular --no-spinner --warning build/esm",
Expand All @@ -22,8 +23,6 @@
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-syntax-typescript": "^7.23.3",
"@babel/types": "^7.24.0",
"@fncts/config": "workspace:*",
"@fncts/eslint-config": "workspace:*",
"@types/babel__core": "^7.20.5",
"@yarnpkg/cli": "4.1.1",
"@yarnpkg/core": "4.0.3",
Expand Down
1 change: 0 additions & 1 deletion packages/test/src/control/Live.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// codegen:start { preset: barrel, include: "./Live/*.ts" }
export * from "./Live/definition.js";
// codegen:end
4 changes: 1 addition & 3 deletions packages/test/src/control/TestRandom/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export function substractArrayIntToNew(arrayIntA: ArrayInt, arrayIntB: ArrayInt)
export function trimArrayIntInplace(arrayInt: ArrayInt) {
const data = arrayInt.data;
let firstNonZero = 0;

for (; firstNonZero !== data.length && data[firstNonZero] === 0; ++firstNonZero) {}
if (firstNonZero === data.length) {
// only zeros
Expand All @@ -263,7 +263,6 @@ export function trimArrayIntInplace(arrayInt: ArrayInt) {
}
data.splice(0, firstNonZero);
return arrayInt;

}
/**
* Add two ArrayInt
Expand Down Expand Up @@ -309,7 +308,6 @@ export function addOneToPositiveArrayInt(arrayInt: ArrayInt): ArrayInt {
}
data.unshift(1);
return arrayInt;

}

function Mash() {
Expand Down
1 change: 0 additions & 1 deletion packages/test/src/data/TestArgs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// codegen:start { preset: barrel, include: ./TestArgs/*.ts }
export * from "./TestArgs/definition.js";
// codegen:end
1 change: 0 additions & 1 deletion packages/test/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// codegen:start { preset: type-barrel, include: ./util/*.ts }
export type {} from "./util/math.js";
// codegen:end
1 change: 0 additions & 1 deletion packages/transformers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"clean": "rm -rf ./build ./dist"
},
"dependencies": {
"@fncts/typelevel": "workspace:*",
"uuid": "^9.0.1"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/typelevel/src/HKT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export interface HKT {
};
}


export namespace HKT {
declare const URI: unique symbol;
declare const CURI: unique symbol;
Expand Down
Loading

0 comments on commit 645ad87

Please sign in to comment.