From 87f7f081f2ed55da83d339611461942b44875830 Mon Sep 17 00:00:00 2001 From: takahashikosuke Date: Thu, 9 Jul 2026 17:27:09 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20fix=20workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f385bf7..fc1b7894 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Restore cache for yarn and lerna - uses: actions/cache@v3.3.2 + uses: actions/cache@v4 id: yarn-cache with: path: | @@ -61,7 +61,7 @@ jobs: run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Restore cache for yarn and lerna - uses: actions/cache@v3.3.2 + uses: actions/cache@v4 id: yarn-cache with: path: | @@ -101,7 +101,7 @@ jobs: run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT - name: Restore cache for yarn and lerna - uses: actions/cache@v3.3.2 + uses: actions/cache@v4 id: yarn-cache with: path: | From cdf64be1378884c4647cfede3182e3b9b745faff Mon Sep 17 00:00:00 2001 From: unblee Date: Thu, 3 Sep 2026 14:42:00 +0900 Subject: [PATCH 2/4] Build before linting in CI The shared ESLint config loads eslint-plugin-wantedly, whose main entry is its build output. The lint job never built, so ESLint failed to load whenever the job had files to lint. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc1b7894..e41218e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,11 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile + # The shared ESLint config pulls in eslint-plugin-wantedly, whose main entry + # is its build output, so ESLint cannot load without building first. + - name: Build + run: yarn build + - name: Run ESLint run: | BASE_BRANCH=${GITHUB_BASE_REF:-master} From 5b640ae599bd321a294013d9b086995899a06fb6 Mon Sep 17 00:00:00 2001 From: unblee Date: Tue, 8 Sep 2026 13:34:49 +0900 Subject: [PATCH 3/4] Rename the packages to the @wantedly scope Co-Authored-By: takahashikosuke Co-Authored-By: Claude Opus 5 (1M context) --- .changeset/gold-insects-wash.md | 4 ++-- .prettierrc | 2 +- .scaffdog/eslint-plugin-wantedly-rule.md | 2 +- eslint.config.mjs | 4 ++-- package.json | 4 ++-- .../__snapshots__/index.test.js.snap | 6 ++--- .../eslint-config-wantedly-typescript/base.js | 2 +- .../package.json | 7 +++--- .../react.js | 2 +- .../__snapshots__/index.test.js.snap | 4 ++-- packages/eslint-config-wantedly/base.js | 2 +- packages/eslint-config-wantedly/package.json | 5 +++-- packages/eslint-plugin-use-macros/index.js | 2 +- .../eslint-plugin-use-macros/package.json | 3 ++- packages/eslint-plugin-wantedly/package.json | 3 ++- .../__snapshots__/index.test.ts.snap | 4 ++-- packages/eslint-plugin-wantedly/src/index.ts | 2 +- packages/frolint/package.json | 9 ++++---- .../frolint/src/commands/DefaultCommand.ts | 22 +------------------ .../frolint/src/commands/ExportCommand.ts | 2 +- .../frolint/src/commands/InstallCommand.ts | 2 +- packages/frolint/src/utils/prettier.ts | 2 +- .../prettier-config-wantedly/package.json | 3 ++- 23 files changed, 42 insertions(+), 56 deletions(-) diff --git a/.changeset/gold-insects-wash.md b/.changeset/gold-insects-wash.md index 64308993..b49a25d4 100644 --- a/.changeset/gold-insects-wash.md +++ b/.changeset/gold-insects-wash.md @@ -1,6 +1,6 @@ --- -"eslint-config-wantedly-typescript": minor -"eslint-config-wantedly": minor +"@wantedly/eslint-config-wantedly-typescript": minor +"@wantedly/eslint-config-wantedly": minor --- refactor(eslint-config-wantedly): Refactor rule set diff --git a/.prettierrc b/.prettierrc index 4d6b01f3..4369d023 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1 +1 @@ -"prettier-config-wantedly" +"@wantedly/prettier-config-wantedly" diff --git a/.scaffdog/eslint-plugin-wantedly-rule.md b/.scaffdog/eslint-plugin-wantedly-rule.md index 3f74a97d..c7188027 100644 --- a/.scaffdog/eslint-plugin-wantedly-rule.md +++ b/.scaffdog/eslint-plugin-wantedly-rule.md @@ -46,7 +46,7 @@ export const RULE = linter.getRules().get(RULE_NAME) as Rule.RuleModule; import { RuleTester } from "eslint"; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore -import ESLintConfigWantedly from "eslint-config-wantedly-typescript"; +import ESLintConfigWantedly from "@wantedly/eslint-config-wantedly-typescript"; import { RULE, RULE_NAME } from "../{{ input }}"; new RuleTester({ diff --git a/eslint.config.mjs b/eslint.config.mjs index 0bfaa7ed..08a1570a 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,5 +1,5 @@ -import { base as eslintConfigWantedly } from "eslint-config-wantedly"; -import { base as eslintConfigWantedlyTs } from "eslint-config-wantedly-typescript"; +import { base as eslintConfigWantedly } from "@wantedly/eslint-config-wantedly"; +import { base as eslintConfigWantedlyTs } from "@wantedly/eslint-config-wantedly-typescript"; /** @type{import('eslint').Linter.Config[]} */ export default [ diff --git a/package.json b/package.json index f93aa28a..b3b18135 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "postinstall": "lerna bootstrap", "pretest": "yarn build", "test": "FORCE_COLOR=1 lerna run --stream test", - "test:watch": "FORCE_COLOR=1 lerna exec --stream --ignore prettier-config-wantedly -- npm run test -- --watch", - "test:watch:frolint": "lerna exec \"npm run test -- --watch\" --scope frolint", + "test:watch": "FORCE_COLOR=1 lerna exec --stream --ignore @wantedly/prettier-config-wantedly -- npm run test -- --watch", + "test:watch:frolint": "lerna exec \"npm run test -- --watch\" --scope @wantedly/frolint", "test:update": "lerna run --stream test -- -u", "format": "prettier --write", "lint": "eslint --cache", diff --git a/packages/eslint-config-wantedly-typescript/__tests__/__snapshots__/index.test.js.snap b/packages/eslint-config-wantedly-typescript/__tests__/__snapshots__/index.test.js.snap index 8fe9b83f..7136652f 100644 --- a/packages/eslint-config-wantedly-typescript/__tests__/__snapshots__/index.test.js.snap +++ b/packages/eslint-config-wantedly-typescript/__tests__/__snapshots__/index.test.js.snap @@ -1166,7 +1166,7 @@ exports[`eslint-config-wantedly-typescript base should match snapshot for 1`] = "import", "jsx-a11y:eslint-plugin-jsx-a11y@6.10.0", "jest:eslint-plugin-jest@28.8.3", - "use-macros:eslint-plugin-use-macros", + "use-macros:@wantedly/eslint-plugin-use-macros", "es-x:eslint-plugin-es-x@8.0.0", ], "processor": undefined, @@ -3394,11 +3394,11 @@ exports[`eslint-config-wantedly-typescript react should match snapshot for 1`] = "import", "jsx-a11y:eslint-plugin-jsx-a11y@6.10.0", "jest:eslint-plugin-jest@28.8.3", - "use-macros:eslint-plugin-use-macros", + "use-macros:@wantedly/eslint-plugin-use-macros", "es-x:eslint-plugin-es-x@8.0.0", "react", "react-hooks", - "wantedly:eslint-plugin-wantedly", + "wantedly:@wantedly/eslint-plugin-wantedly", ], "processor": undefined, "rules": { diff --git a/packages/eslint-config-wantedly-typescript/base.js b/packages/eslint-config-wantedly-typescript/base.js index dbcbb211..66c1d165 100644 --- a/packages/eslint-config-wantedly-typescript/base.js +++ b/packages/eslint-config-wantedly-typescript/base.js @@ -1,10 +1,10 @@ const eslintJs = require("@eslint/js"); +const pluginUseMacros = require("@wantedly/eslint-plugin-use-macros"); const configPrettier = require("eslint-config-prettier"); const pluginESx = require("eslint-plugin-es-x"); const pluginImport = require("eslint-plugin-import"); const pluginJest = require("eslint-plugin-jest"); const pluginJsxA11y = require("eslint-plugin-jsx-a11y"); -const pluginUseMacros = require("eslint-plugin-use-macros"); const globals = require("globals"); const eslintTs = require("typescript-eslint"); diff --git a/packages/eslint-config-wantedly-typescript/package.json b/packages/eslint-config-wantedly-typescript/package.json index ddd1d0a5..a9c39072 100644 --- a/packages/eslint-config-wantedly-typescript/package.json +++ b/packages/eslint-config-wantedly-typescript/package.json @@ -1,5 +1,5 @@ { - "name": "eslint-config-wantedly-typescript", + "name": "@wantedly/eslint-config-wantedly-typescript", "description": "ESLint configuration for Wantedly with TypeScript", "version": "4.0.0", "author": "Yuki Yamada ", @@ -14,8 +14,8 @@ "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-use-macros": "^4.0.0", - "eslint-plugin-wantedly": "^4.0.0", + "@wantedly/eslint-plugin-use-macros": "^4.0.0", + "@wantedly/eslint-plugin-wantedly": "^4.0.0", "globals": "^15.9.0", "typescript-eslint": "^8.6.0" }, @@ -30,6 +30,7 @@ "main": "index.js", "private": false, "publishConfig": { + "registry": "https://npm.pkg.github.com", "access": "public" }, "repository": "https://github.com/wantedly/frolint/tree/master/packages/eslint-config-wantedly-typescript", diff --git a/packages/eslint-config-wantedly-typescript/react.js b/packages/eslint-config-wantedly-typescript/react.js index 2792e9e5..ce11b140 100644 --- a/packages/eslint-config-wantedly-typescript/react.js +++ b/packages/eslint-config-wantedly-typescript/react.js @@ -1,6 +1,6 @@ +const pluginWantedly = require("@wantedly/eslint-plugin-wantedly"); const pluginReact = require("eslint-plugin-react"); const pluginReactHooks = require("eslint-plugin-react-hooks"); -const pluginWantedly = require("eslint-plugin-wantedly"); const eslintTs = require("typescript-eslint"); const baseConfig = require("./base"); diff --git a/packages/eslint-config-wantedly/__tests__/__snapshots__/index.test.js.snap b/packages/eslint-config-wantedly/__tests__/__snapshots__/index.test.js.snap index 7137188f..e5598726 100644 --- a/packages/eslint-config-wantedly/__tests__/__snapshots__/index.test.js.snap +++ b/packages/eslint-config-wantedly/__tests__/__snapshots__/index.test.js.snap @@ -1174,7 +1174,7 @@ exports[`eslint-config-wantedly base should match snapshot for 1`] = ` "import", "jsx-a11y:eslint-plugin-jsx-a11y@6.10.0", "jest:eslint-plugin-jest@28.8.3", - "use-macros:eslint-plugin-use-macros", + "use-macros:@wantedly/eslint-plugin-use-macros", "es-x:eslint-plugin-es-x@8.0.0", ], "processor": undefined, @@ -3263,7 +3263,7 @@ exports[`eslint-config-wantedly react should match snapshot for 1`] = ` "import", "jsx-a11y:eslint-plugin-jsx-a11y@6.10.0", "jest:eslint-plugin-jest@28.8.3", - "use-macros:eslint-plugin-use-macros", + "use-macros:@wantedly/eslint-plugin-use-macros", "es-x:eslint-plugin-es-x@8.0.0", "react", "react-hooks", diff --git a/packages/eslint-config-wantedly/base.js b/packages/eslint-config-wantedly/base.js index 9114af2c..fe6ac647 100644 --- a/packages/eslint-config-wantedly/base.js +++ b/packages/eslint-config-wantedly/base.js @@ -1,11 +1,11 @@ const babelEslintParser = require("@babel/eslint-parser"); const js = require("@eslint/js"); +const pluginUseMacros = require("@wantedly/eslint-plugin-use-macros"); const configPrettier = require("eslint-config-prettier"); const pluginESx = require("eslint-plugin-es-x"); const pluginImport = require("eslint-plugin-import"); const pluginJest = require("eslint-plugin-jest"); const pluginJsxA11Y = require("eslint-plugin-jsx-a11y"); -const pluginUseMacros = require("eslint-plugin-use-macros"); const globals = require("globals"); /** @type{import('eslint').Linter.Config[]} */ diff --git a/packages/eslint-config-wantedly/package.json b/packages/eslint-config-wantedly/package.json index ab603c65..ca6530a3 100644 --- a/packages/eslint-config-wantedly/package.json +++ b/packages/eslint-config-wantedly/package.json @@ -1,5 +1,5 @@ { - "name": "eslint-config-wantedly", + "name": "@wantedly/eslint-config-wantedly", "description": "ESLint configuration for Wantedly", "version": "4.0.0", "author": "Yuki Yamada ", @@ -15,7 +15,7 @@ "eslint-plugin-jsx-a11y": "^6.10.0", "eslint-plugin-react": "^7.37.0", "eslint-plugin-react-hooks": "^5.0.0", - "eslint-plugin-use-macros": "^4.0.0", + "@wantedly/eslint-plugin-use-macros": "^4.0.0", "globals": "^15.9.0" }, "homepage": "https://github.com/wantedly/frolint", @@ -26,6 +26,7 @@ "main": "index.js", "private": false, "publishConfig": { + "registry": "https://npm.pkg.github.com", "access": "public" }, "repository": "https://github.com/wantedly/frolint/tree/master/packages/eslint-config-wantedly", diff --git a/packages/eslint-plugin-use-macros/index.js b/packages/eslint-plugin-use-macros/index.js index f081bafb..34631615 100644 --- a/packages/eslint-plugin-use-macros/index.js +++ b/packages/eslint-plugin-use-macros/index.js @@ -4,7 +4,7 @@ const StyledComponents = require("./rules/StyledComponents"); /** @type {import('eslint').ESLint.Plugin } */ module.exports = { meta: { - name: "eslint-plugin-use-macros", + name: "@wantedly/eslint-plugin-use-macros", }, rules: { "graphql-tag": GraphQLTag, diff --git a/packages/eslint-plugin-use-macros/package.json b/packages/eslint-plugin-use-macros/package.json index 27b4a1f0..c99ea5cd 100644 --- a/packages/eslint-plugin-use-macros/package.json +++ b/packages/eslint-plugin-use-macros/package.json @@ -1,5 +1,5 @@ { - "name": "eslint-plugin-use-macros", + "name": "@wantedly/eslint-plugin-use-macros", "description": "ESLint rules for libraries which supports the babel-macros", "version": "4.0.1", "author": "Yuki Yamada ", @@ -12,6 +12,7 @@ "license": "MIT", "main": "index.js", "publishConfig": { + "registry": "https://npm.pkg.github.com", "access": "public" }, "repository": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-use-macros", diff --git a/packages/eslint-plugin-wantedly/package.json b/packages/eslint-plugin-wantedly/package.json index 0d4d6694..9e79da3b 100644 --- a/packages/eslint-plugin-wantedly/package.json +++ b/packages/eslint-plugin-wantedly/package.json @@ -1,5 +1,5 @@ { - "name": "eslint-plugin-wantedly", + "name": "@wantedly/eslint-plugin-wantedly", "description": "Opinionated ESLint plugin for Wantedly", "version": "4.0.1", "author": "Yuki Yamada ", @@ -12,6 +12,7 @@ "license": "MIT", "main": "lib/index.js", "publishConfig": { + "registry": "https://npm.pkg.github.com", "access": "public" }, "repository": "https://github.com/wantedly/frolint/tree/master/packages/eslint-plugin-wantedly", diff --git a/packages/eslint-plugin-wantedly/src/__tests__/__snapshots__/index.test.ts.snap b/packages/eslint-plugin-wantedly/src/__tests__/__snapshots__/index.test.ts.snap index a0b9a38e..7de9f289 100644 --- a/packages/eslint-plugin-wantedly/src/__tests__/__snapshots__/index.test.ts.snap +++ b/packages/eslint-plugin-wantedly/src/__tests__/__snapshots__/index.test.ts.snap @@ -4,7 +4,7 @@ exports[`should match snapshot 1`] = ` { "default": { "meta": { - "name": "eslint-plugin-wantedly", + "name": "@wantedly/eslint-plugin-wantedly", }, "rules": { "graphql-operation-name": { @@ -144,7 +144,7 @@ exports[`should match snapshot 1`] = ` }, }, "meta": { - "name": "eslint-plugin-wantedly", + "name": "@wantedly/eslint-plugin-wantedly", }, "rules": { "graphql-operation-name": { diff --git a/packages/eslint-plugin-wantedly/src/index.ts b/packages/eslint-plugin-wantedly/src/index.ts index 1e3f0fba..4a55213b 100644 --- a/packages/eslint-plugin-wantedly/src/index.ts +++ b/packages/eslint-plugin-wantedly/src/index.ts @@ -11,7 +11,7 @@ import * as NEXUS_UPPER_CASE_ENUM_MEMBERS from "./rules/nexus-upper-case-enum-me const plugins: ESLint.Plugin = { meta: { - name: "eslint-plugin-wantedly", + name: "@wantedly/eslint-plugin-wantedly", }, rules: { [GRAPHQL_OPERATION_NAME.RULE_NAME]: GRAPHQL_OPERATION_NAME.RULE, diff --git a/packages/frolint/package.json b/packages/frolint/package.json index 4f94993c..050cca1d 100644 --- a/packages/frolint/package.json +++ b/packages/frolint/package.json @@ -1,5 +1,5 @@ { - "name": "frolint", + "name": "@wantedly/frolint", "description": "git commit hook linter", "version": "4.0.0", "author": "Yuki Yamada ", @@ -11,10 +11,10 @@ "cosmiconfig": "^7.0.0", "debug": "^4.3.2", "eslint": "^9.0.0", - "eslint-config-wantedly": "^4.0.0", - "eslint-config-wantedly-typescript": "^4.0.0", + "@wantedly/eslint-config-wantedly": "^4.0.0", + "@wantedly/eslint-config-wantedly-typescript": "^4.0.0", "prettier": "^2.4.1", - "prettier-config-wantedly": "^3.2.2", + "@wantedly/prettier-config-wantedly": "^3.2.2", "resolve": "^1.20.0" }, "homepage": "https://github.com/wantedly/frolint", @@ -24,6 +24,7 @@ ], "license": "MIT", "publishConfig": { + "registry": "https://npm.pkg.github.com", "access": "public" }, "repository": "https://github.com/wantedly/frolint/tree/master/packages/frolint", diff --git a/packages/frolint/src/commands/DefaultCommand.ts b/packages/frolint/src/commands/DefaultCommand.ts index 4bea26be..c92fe3be 100644 --- a/packages/frolint/src/commands/DefaultCommand.ts +++ b/packages/frolint/src/commands/DefaultCommand.ts @@ -1,5 +1,5 @@ import { writeFileSync } from "fs"; -import { relative, resolve } from "path"; +import { relative } from "path"; import chalk from "chalk"; import { Command } from "clipanion"; @@ -108,26 +108,6 @@ export class DefaultCommand extends Command { log("Target Files: %O", files); - const eslintConfigPackage = isTypeScript ? "eslint-config-wantedly-typescript" : "eslint-config-wantedly"; - - log("ESLint Config: %o", { eslintConfigPackage }); - - /** - * Resolve package.json from eslintConfigPackage - * node_modules/frolint/lib/commands -> node_modules/`eslintConfigPackage`/package.json - * - * node_modules/ - * frolint/ - * lib/ - * commands/ <-- __dirname - * `eslintConfigPackage`/ - * package.json - */ - const pkg = require(resolve(__dirname, "..", "..", "..", eslintConfigPackage, "package.json")); - Object.keys(pkg.dependencies).forEach((key) => { - module.paths.push(resolve(__dirname, "..", "..", "..", key, "node_modules")); - }); - const shouldStageFiles = new Set(); log("Start applying ESLint"); diff --git a/packages/frolint/src/commands/ExportCommand.ts b/packages/frolint/src/commands/ExportCommand.ts index 94c4b220..6246c09d 100644 --- a/packages/frolint/src/commands/ExportCommand.ts +++ b/packages/frolint/src/commands/ExportCommand.ts @@ -57,7 +57,7 @@ export class ExportCommand extends Command { log("Prettier config file not found"); if (err && (err as NodeJS.ErrnoException).code === "ENOENT") { - const prettierrcContent = `"prettier-config-wantedly"\n`; + const prettierrcContent = `"@wantedly/prettier-config-wantedly"\n`; log("Export Prettier config file"); diff --git a/packages/frolint/src/commands/InstallCommand.ts b/packages/frolint/src/commands/InstallCommand.ts index 4c10e29f..ee9926b2 100644 --- a/packages/frolint/src/commands/InstallCommand.ts +++ b/packages/frolint/src/commands/InstallCommand.ts @@ -89,7 +89,7 @@ export class InstallCommand extends Command { function render({ append }: { append: boolean }) { return `${append ? "" : "#!/bin/sh\n"}${START_COMMENT} -scriptPath="node_modules/frolint/index.js" +scriptPath="node_modules/@wantedly/frolint/index.js" hookName="pre-commit" gitParams="$*" diff --git a/packages/frolint/src/utils/prettier.ts b/packages/frolint/src/utils/prettier.ts index 198f0846..81a52714 100644 --- a/packages/frolint/src/utils/prettier.ts +++ b/packages/frolint/src/utils/prettier.ts @@ -1,9 +1,9 @@ import { readFileSync } from "fs"; import { extname, resolve } from "path"; +import prettierConfigWantedly from "@wantedly/prettier-config-wantedly"; import type { BuiltInParserName, ResolveConfigOptions } from "prettier"; import prettier from "prettier"; -import prettierConfigWantedly from "prettier-config-wantedly"; import type { FrolintConfig } from "../Context"; diff --git a/packages/prettier-config-wantedly/package.json b/packages/prettier-config-wantedly/package.json index f430e371..3eb96b82 100644 --- a/packages/prettier-config-wantedly/package.json +++ b/packages/prettier-config-wantedly/package.json @@ -1,5 +1,5 @@ { - "name": "prettier-config-wantedly", + "name": "@wantedly/prettier-config-wantedly", "version": "3.2.2", "description": "Prettier configuration for Wantedly", "keywords": [ @@ -10,6 +10,7 @@ "license": "MIT", "main": "index.json", "publishConfig": { + "registry": "https://npm.pkg.github.com", "access": "public" }, "repository": "https://github.com/wantedly/frolint/tree/master/packages/prettier-config-wantedly" From 729351b1d4a63d00fb9910123db18537c6485638 Mon Sep 17 00:00:00 2001 From: unblee Date: Tue, 8 Sep 2026 14:20:35 +0900 Subject: [PATCH 4/4] Keep the ESLint config resolution in DefaultCommand The three-level resolve keeps working after the rename because frolint and the config packages both move under the same @wantedly scope directory. Co-Authored-By: Claude Opus 5 (1M context) --- .../frolint/src/commands/DefaultCommand.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/frolint/src/commands/DefaultCommand.ts b/packages/frolint/src/commands/DefaultCommand.ts index c92fe3be..4bea26be 100644 --- a/packages/frolint/src/commands/DefaultCommand.ts +++ b/packages/frolint/src/commands/DefaultCommand.ts @@ -1,5 +1,5 @@ import { writeFileSync } from "fs"; -import { relative } from "path"; +import { relative, resolve } from "path"; import chalk from "chalk"; import { Command } from "clipanion"; @@ -108,6 +108,26 @@ export class DefaultCommand extends Command { log("Target Files: %O", files); + const eslintConfigPackage = isTypeScript ? "eslint-config-wantedly-typescript" : "eslint-config-wantedly"; + + log("ESLint Config: %o", { eslintConfigPackage }); + + /** + * Resolve package.json from eslintConfigPackage + * node_modules/frolint/lib/commands -> node_modules/`eslintConfigPackage`/package.json + * + * node_modules/ + * frolint/ + * lib/ + * commands/ <-- __dirname + * `eslintConfigPackage`/ + * package.json + */ + const pkg = require(resolve(__dirname, "..", "..", "..", eslintConfigPackage, "package.json")); + Object.keys(pkg.dependencies).forEach((key) => { + module.paths.push(resolve(__dirname, "..", "..", "..", key, "node_modules")); + }); + const shouldStageFiles = new Set(); log("Start applying ESLint");