Skip to content

Commit

Permalink
chore(plugin-eslint): fix ESLint issues in test files, enable node-pr…
Browse files Browse the repository at this point in the history
…otocol rule
  • Loading branch information
Tlacenka committed Jan 10, 2024
1 parent 669d86a commit a2ab7fb
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 22 deletions.
2 changes: 0 additions & 2 deletions packages/plugin-eslint/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
"@typescript-eslint/no-unsafe-return": "off", // 2 errors
"functional/immutable-data": "off", // 2 errors
"sonarjs/no-nested-template-literals": "off", // 1 error
"unicorn/better-regex": "off", // 1 warning
"unicorn/explicit-length-check": "off", // 1 warning
"unicorn/import-style": "off", // 5 warnings
"unicorn/prefer-node-protocol": "off", // 14 warnings
"unicorn/prefer-top-level-await": "off" // 1 warning
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os from 'os';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import os from 'node:os';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { SpyInstance } from 'vitest';
import type { Audit, PluginConfig, RunnerConfig } from '@code-pushup/models';
import { toUnixPath } from '@code-pushup/utils';
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-eslint/src/lib/eslint-plugin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mkdir, writeFile } from 'fs/promises';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { mkdir, writeFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { PluginConfig } from '@code-pushup/models';
import { name, version } from '../../package.json';
import { ESLintPluginConfig, eslintPluginConfigSchema } from './config';
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-eslint/src/lib/meta/hash.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHash } from 'crypto';
import { createHash } from 'node:crypto';
import { slugify } from '@code-pushup/utils';

export function ruleIdToSlug(
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-eslint/src/lib/meta/hash.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ describe('jsonHash', () => {
])('should produce short hexadecimal hash for rule options: %j', options => {
const hash = jsonHash(options);
expect(hash).toHaveLength(16);
expect(hash).toMatch(/^[0-9a-f]+$/);
expect(hash).toMatch(/^[\da-f]+$/);
});
});
4 changes: 2 additions & 2 deletions packages/plugin-eslint/src/lib/meta/rules.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ESLint } from 'eslint';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { SpyInstance } from 'vitest';
import { RuleData, listRules, parseRuleId } from './rules';

Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-eslint/src/lib/nx.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { setWorkspaceRoot } from 'nx/src/utils/workspace-root';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import type { SpyInstance } from 'vitest';
import { ESLintPluginConfig } from './config';
import { eslintConfigFromNxProject, eslintConfigFromNxProjects } from './nx';
Expand Down
10 changes: 5 additions & 5 deletions packages/plugin-eslint/src/lib/runner.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { ESLint } from 'eslint';
import { mkdir, rm, writeFile } from 'fs/promises';
import os from 'os';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import type { SpyInstance } from 'vitest';
import { mkdir, rm, writeFile } from 'node:fs/promises';
import os from 'node:os';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { SpyInstance, describe, expect, it } from 'vitest';
import type { AuditOutput, Issue } from '@code-pushup/models';
import { readJsonFile } from '@code-pushup/utils';
import { listAuditsAndGroups } from './meta';
Expand Down
6 changes: 3 additions & 3 deletions packages/plugin-eslint/src/lib/runner/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { mkdir, writeFile } from 'fs/promises';
import { platform } from 'os';
import { dirname, join } from 'path';
import { mkdir, writeFile } from 'node:fs/promises';
import { platform } from 'node:os';
import { dirname, join } from 'node:path';
import type { Audit, AuditOutput, RunnerConfig } from '@code-pushup/models';
import { pluginWorkDir, readJsonFile, toArray } from '@code-pushup/utils';
import { lint } from './lint';
Expand Down

0 comments on commit a2ab7fb

Please sign in to comment.