@particle/tooling 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,6 +24,7 @@ What it does, depending on what it finds:
24
24
  - **Lint and format configs:** deletes `eslint.config.*`, `.eslintrc*`, `.oxlintrc.json` and `.oxfmtrc.json`, and creates `oxlint.config.ts` and `oxfmt.config.ts` that re-export the shared configs. TypeScript projects re-export `@particle/tooling/oxlint-typescript`, JavaScript projects `@particle/tooling/oxlint`.
25
25
  - **tsconfigs:** rewrites `tsconfig.json` and `tsconfig.build.json` to extend the shared configs, keeping the project's own `include`, `exclude` and `types`. A config with other project-specific compiler options, or one that already extends something else, is left alone and reported for you to migrate by hand.
26
26
  - **Sentry:** when the project depends on a `@sentry/*` package, the build config gets `"sourceRoot": "/"`, which strips the build path from source references so Sentry groups issues consistently. Without Sentry it is removed, because it makes Node stack traces point at paths that do not exist.
27
+ - **`.gitignore`:** adds `.claude/`, so agent worktrees (full copies of the repo) are not linted and formatted along with the project. oxlint and oxfmt only skip what the project's own `.gitignore` lists, not a global gitignore.
27
28
  - **Build output:** standardizes on `build/`, adds it to `.gitignore`, and lists every place that still names the old directory (`package.json` fields, scripts, `Dockerfile`, CI config) for you to update.
28
29
  - **Scripts:** removes a `lint` script and has `check` do the linting: plain `eslint` steps become `oxlint --deny-warnings` (so a warning fails the check, in CI too), `check` gains `oxfmt --check`, and other scripts that ran `npm run lint` are pointed at `npm run check`. Adds `fmt` where it is missing, a `check` for TypeScript projects (`tsc && oxlint --deny-warnings && oxfmt --check`) and for JavaScript projects that had a `lint` script, and `build` for TypeScript projects.
29
30
  - **CI:** looks at `.circleci/config.yml` and `.github/workflows` and reminds you to confirm that CI runs a step that checks formatting.
package/lib/migrate.js CHANGED
@@ -57,6 +57,8 @@ const FORMAT_SCRIPTS = {
57
57
  };
58
58
 
59
59
  const BUILD_DIR = 'build';
60
+ /** Holds agent worktrees, which are full copies of the repo. oxlint and oxfmt skip it only when the project's own .gitignore lists it. */
61
+ const AGENT_DIR = '.claude';
60
62
  const BUILD_SCRIPT = `rm -rf ${BUILD_DIR}/ && tsc -p tsconfig.build.json`;
61
63
  const OUT_DIR_REFERENCE_FILES = ['.gitignore', '.dockerignore', 'Dockerfile', '.circleci/config.yml'];
62
64
  const REDUNDANT_UNDER_STRICT = new Set(['noImplicitAny', 'strictNullChecks']);
@@ -624,14 +626,14 @@ export async function createPlan(dir, style, options = {}) {
624
626
  );
625
627
  const { hasBuildConfig, previousOutDir } = await planTsconfigs(dir, style, plan, hasSentry);
626
628
 
627
- if (hasBuildConfig) {
628
- const gitignore = (await readOptional(dir, '.gitignore')) ?? '';
629
- const ignored = gitignore.split('\n').some((line) => directoryOf(line.trim().replace(/^\//, '')) === BUILD_DIR);
630
- if (!ignored) {
631
- const separator = gitignore === '' || gitignore.endsWith('\n') ? '' : '\n';
632
- plan.writes.push({ file: '.gitignore', contents: `${gitignore}${separator}${BUILD_DIR}/\n` });
633
- plan.files.push(`add ${BUILD_DIR}/ to .gitignore`);
634
- }
629
+ const gitignore = (await readOptional(dir, '.gitignore')) ?? '';
630
+ const ignoredDirectories = new Set(gitignore.split('\n').map((line) => directoryOf(line.trim().replace(/^\//, ''))));
631
+ const toIgnore = [...(hasBuildConfig ? [BUILD_DIR] : []), AGENT_DIR].filter((name) => !ignoredDirectories.has(name));
632
+ if (toIgnore.length > 0) {
633
+ const separator = gitignore === '' || gitignore.endsWith('\n') ? '' : '\n';
634
+ const lines = toIgnore.map((name) => `${name}/\n`).join('');
635
+ plan.writes.push({ file: '.gitignore', contents: `${gitignore}${separator}${lines}` });
636
+ plan.files.push(`add ${toIgnore.map((name) => `${name}/`).join(' and ')} to .gitignore`);
635
637
  }
636
638
  if (previousOutDir !== null && previousOutDir !== BUILD_DIR) {
637
639
  const references = await findOutDirReferences(dir, original, previousOutDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@particle/tooling",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Shared oxlint, oxfmt and TypeScript configuration for Particle projects",
5
5
  "homepage": "https://github.com/particle-iot-inc/particle-tooling",
6
6
  "bugs": {