diff --git a/clients/js/.eslintignore b/clients/js/.eslintignore new file mode 100644 index 000000000..c7d8c77f4 --- /dev/null +++ b/clients/js/.eslintignore @@ -0,0 +1,10 @@ +*.json +*.md +*.css +*.d.ts + +node_modules/ +dist/ +main/ +module/ +coverage/ \ No newline at end of file diff --git a/clients/js/package.json b/clients/js/package.json index cfb9f36bf..e2cb8cdb5 100644 --- a/clients/js/package.json +++ b/clients/js/package.json @@ -18,6 +18,8 @@ "clean": "lerna run clean", "build": "lerna run build --stream", "symlink": "symlink-workspace --logLevel error", + "lint": "lerna run lint", + "format": "lerna run format", "postinstall": "yarn symlink", "publish": "yarn build; yarn lerna publish --no-private", "publish:minor": "yarn build; yarn lerna publish minor --no-private" diff --git a/clients/js/packages/cli/.eslintignore b/clients/js/packages/cli/.eslintignore new file mode 100644 index 000000000..31430a2e8 --- /dev/null +++ b/clients/js/packages/cli/.eslintignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +main/ +module/ +coverage/ +prompt.js \ No newline at end of file diff --git a/clients/js/packages/cli/package.json b/clients/js/packages/cli/package.json index a06d66676..e3ab6fe62 100644 --- a/clients/js/packages/cli/package.json +++ b/clients/js/packages/cli/package.json @@ -29,6 +29,8 @@ "build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy; npm run chmod", "chmod": "chmod +x dist/index.js", "dev": "ts-node src/index", + "lint": "eslint .", + "format": "eslint . --fix", "test": "jest", "test:watch": "jest --watch" }, diff --git a/clients/js/packages/cli/src/index.ts b/clients/js/packages/cli/src/index.ts index 7c51f2a57..0dc760531 100755 --- a/clients/js/packages/cli/src/index.ts +++ b/clients/js/packages/cli/src/index.ts @@ -3,7 +3,7 @@ import { StarshipClient, StarshipInstaller } from '@starship-ci/client'; // Adju import { Inquirerer, type Question } from 'inquirerer'; import minimist from 'minimist'; -import { displayUsage, displayVersion, loadConfig, usageText, params } from './utils'; +import { displayUsage, displayVersion, loadConfig, params,usageText } from './utils'; const argv = minimist(process.argv.slice(2), { alias: { diff --git a/clients/js/packages/cli/src/utils.ts b/clients/js/packages/cli/src/utils.ts index c331826c1..9fcd59e8e 100644 --- a/clients/js/packages/cli/src/utils.ts +++ b/clients/js/packages/cli/src/utils.ts @@ -1,12 +1,10 @@ import {defaultStarshipContext, StarshipConfig, StarshipContext} from '@starship-ci/client'; // Adjust the import path as necessary -import { type Question } from 'inquirerer'; import chalk from 'chalk'; import {readFileSync} from 'fs'; import * as yaml from 'js-yaml'; -import {dirname, resolve} from 'path'; +import { resolve} from 'path'; import {readAndParsePackageJson} from './package'; -import deepmerge from 'deepmerge'; // Function to display the version information export function displayVersion() { diff --git a/clients/js/packages/client/.eslintignore b/clients/js/packages/client/.eslintignore new file mode 100644 index 000000000..31430a2e8 --- /dev/null +++ b/clients/js/packages/client/.eslintignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +main/ +module/ +coverage/ +prompt.js \ No newline at end of file diff --git a/clients/js/packages/client/package.json b/clients/js/packages/client/package.json index 8d8ae88a9..dad88fdb6 100644 --- a/clients/js/packages/client/package.json +++ b/clients/js/packages/client/package.json @@ -24,6 +24,8 @@ "clean": "del dist/**", "prepare": "npm run build", "build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy", + "lint": "eslint .", + "format": "eslint . --fix", "test": "jest", "test:watch": "jest --watch" }, diff --git a/clients/js/packages/client/src/client.ts b/clients/js/packages/client/src/client.ts index cda53e6d2..0d7186f49 100644 --- a/clients/js/packages/client/src/client.ts +++ b/clients/js/packages/client/src/client.ts @@ -7,7 +7,7 @@ import * as os from 'os'; import { dirname, resolve } from 'path'; import * as shell from 'shelljs'; -import {Chain, Relayer, Script, StarshipConfig} from './config'; +import {Chain, Relayer, StarshipConfig} from './config'; import { Ports } from './config'; import { dependencies as defaultDependencies, Dependency } from "./deps"; import { readAndParsePackageJson } from './package'; diff --git a/clients/js/packages/starshipjs/.eslintignore b/clients/js/packages/starshipjs/.eslintignore new file mode 100644 index 000000000..31430a2e8 --- /dev/null +++ b/clients/js/packages/starshipjs/.eslintignore @@ -0,0 +1,6 @@ +node_modules/ +dist/ +main/ +module/ +coverage/ +prompt.js \ No newline at end of file diff --git a/clients/js/packages/starshipjs/__tests__/config.test.ts b/clients/js/packages/starshipjs/__tests__/config.test.ts index 5508c2291..669b32a65 100644 --- a/clients/js/packages/starshipjs/__tests__/config.test.ts +++ b/clients/js/packages/starshipjs/__tests__/config.test.ts @@ -1,7 +1,7 @@ +import { ChainRegistryFetcher } from "@chain-registry/client"; import path from "path"; import { Config, ConfigContext } from "../src/config"; -import { ChainRegistryFetcher } from "@chain-registry/client"; // it's more recommended to use ConfigContext.init to set the config file and registry. it("1. throws without init;\n 2. init the setup and gets config;\n 3. throws when double init;\n", async () => { diff --git a/clients/js/packages/starshipjs/__tests__/legacy.test.ts b/clients/js/packages/starshipjs/__tests__/legacy.test.ts index e2eafee49..6ce477f6e 100644 --- a/clients/js/packages/starshipjs/__tests__/legacy.test.ts +++ b/clients/js/packages/starshipjs/__tests__/legacy.test.ts @@ -1,7 +1,7 @@ +import { ChainRegistryFetcher } from "@chain-registry/client"; import path from "path"; -import { Config, ConfigContext } from "../src/config"; -import { ChainRegistryFetcher } from "@chain-registry/client"; +import { ConfigContext } from "../src/config"; // people can still use legacy ConfigContext to set the config file and registry. it("1. throws without init;\n 2. throws only init partially;\n 3. init the setup and gets config;\n 4. throws when double init;\n", async () => { diff --git a/clients/js/packages/starshipjs/package.json b/clients/js/packages/starshipjs/package.json index 33de205cd..a166007bc 100644 --- a/clients/js/packages/starshipjs/package.json +++ b/clients/js/packages/starshipjs/package.json @@ -24,6 +24,8 @@ "clean": "del dist/**", "prepare": "npm run build", "build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy", + "lint": "eslint .", + "format": "eslint . --fix", "test": "jest", "test:watch": "jest --watch" },