pr-checkmate 1.0.8 → 1.0.9

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.
@@ -5,28 +5,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runLint = runLint;
7
7
  const execa_1 = require("execa");
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const config_1 = require("../config");
8
+ const node_path_1 = __importDefault(require("node:path"));
10
9
  const utils_1 = require("../utils");
10
+ const INTERNAL_ESLINT_CONFIG = node_path_1.default.resolve(__dirname, '../eslint.config.mjs');
11
11
  /**
12
- * Run ESLint on the project.
12
+ * Run ESLint using the internal config.
13
13
  * Ignores node_modules, dist, and .git automatically.
14
- *
15
- * @throws Will throw an error if ESLint detects issues that cannot be fixed automatically.
16
14
  */
17
15
  async function runLint() {
18
16
  utils_1.logger.info('Running ESLint...');
19
- const hasLocalConfig = node_fs_1.default.existsSync('eslint.config.mjs') ||
20
- node_fs_1.default.existsSync('.eslintrc.js') ||
21
- node_fs_1.default.existsSync('.eslintrc.json');
22
- const basePath = hasLocalConfig ? '.' : config_1.SOURCE_PATH;
17
+ const projectPath = node_path_1.default.resolve(process.cwd());
23
18
  const ignorePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'];
24
19
  const args = [
25
20
  'eslint',
26
- basePath,
21
+ projectPath,
27
22
  '--ext',
28
23
  '.ts,.tsx',
29
24
  '--fix',
25
+ '--config',
26
+ INTERNAL_ESLINT_CONFIG,
30
27
  ...ignorePatterns.flatMap(p => ['--ignore-pattern', p]),
31
28
  ];
32
29
  try {
@@ -4,29 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.runPrettier = runPrettier;
7
+ // src/scripts/prettier-autoformat.ts
7
8
  const execa_1 = require("execa");
8
- const node_fs_1 = __importDefault(require("node:fs"));
9
- const config_1 = require("../config");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
10
  const utils_1 = require("../utils");
11
+ const INTERNAL_PRETTIER_CONFIG = node_path_1.default.resolve(__dirname, '../.prettierrc');
11
12
  /**
12
- * Run Prettier to auto-format project files.
13
- * Ignores node_modules, dist, and .git folders automatically.
14
- *
15
- * @throws Will throw an error if Prettier fails.
13
+ * Run Prettier using internal config.
14
+ * Ignores node_modules, dist, and .git automatically.
16
15
  */
17
16
  async function runPrettier() {
18
17
  utils_1.logger.info('Running Prettier...');
19
- const hasConfig = node_fs_1.default.existsSync('.prettierrc') ||
20
- node_fs_1.default.existsSync('.prettierrc.json') ||
21
- node_fs_1.default.existsSync('prettier.config.js');
22
- // Run on whole project if config exists, otherwise only SOURCE_PATH
23
- const pattern = hasConfig
24
- ? '**/*.{ts,tsx,js,jsx,json,md}'
25
- : `${config_1.SOURCE_PATH}/**/*.{ts,tsx,js,jsx,json,md}`;
26
- // Prettier ignore patterns
18
+ const projectPath = node_path_1.default.resolve(process.cwd());
27
19
  const ignorePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'];
20
+ const args = [
21
+ 'prettier',
22
+ '--write',
23
+ projectPath,
24
+ '--config',
25
+ INTERNAL_PRETTIER_CONFIG,
26
+ ...ignorePatterns.flatMap(p => ['--ignore-path', p]),
27
+ ];
28
28
  try {
29
- await (0, execa_1.execa)('npx', ['prettier', '--write', pattern, ...ignorePatterns.flatMap(p => ['--ignore-path', p])], { stdio: 'inherit' });
29
+ await (0, execa_1.execa)('npx', args, { stdio: 'inherit' });
30
30
  utils_1.logger.info('✅ Prettier completed');
31
31
  }
32
32
  catch (err) {
@@ -1,23 +1,31 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.runSpellcheck = runSpellcheck;
7
+ // src/scripts/spellcheck.ts
4
8
  const execa_1 = require("execa");
5
- const config_1 = require("../config");
9
+ const node_path_1 = __importDefault(require("node:path"));
6
10
  const utils_1 = require("../utils");
11
+ const INTERNAL_CSPELL_CONFIG = node_path_1.default.resolve(__dirname, '../cspell.json');
7
12
  /**
8
- * Run cspell to check spelling in project files.
9
- * Ignores node_modules, dist, and .git folders automatically.
10
- *
11
- * @throws Will throw an error if spelling issues are detected.
13
+ * Run spellcheck using internal cspell config.
14
+ * Ignores node_modules, dist, and .git automatically.
12
15
  */
13
16
  async function runSpellcheck() {
14
17
  utils_1.logger.info('Running spellcheck...');
15
- const pattern = `${config_1.SOURCE_PATH}/**/*`;
18
+ const projectPath = node_path_1.default.resolve(process.cwd());
16
19
  const ignorePatterns = ['**/node_modules/**', '**/dist/**', '**/.git/**'];
20
+ const args = [
21
+ 'cspell',
22
+ projectPath,
23
+ '--config',
24
+ INTERNAL_CSPELL_CONFIG,
25
+ ...ignorePatterns.flatMap(p => ['--exclude', p]),
26
+ ];
17
27
  try {
18
- await (0, execa_1.execa)('npx', ['cspell', pattern, ...ignorePatterns.flatMap(p => ['--ignore', p])], {
19
- stdio: 'inherit',
20
- });
28
+ await (0, execa_1.execa)('npx', args, { stdio: 'inherit' });
21
29
  utils_1.logger.info('✅ Spellcheck passed');
22
30
  }
23
31
  catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-checkmate",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Automated PR quality checks: linting, formatting, dependency analysis, and spellcheck",
5
5
  "keywords": [
6
6
  "github-actions",