Skip to content

Commit

Permalink
removing eslintrc.json and eslintignore and adding test for eslint.co…
Browse files Browse the repository at this point in the history
…nfig.mjs
  • Loading branch information
Suyash878 committed Dec 30, 2024
1 parent b7281f4 commit 80067b5
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 213 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

157 changes: 0 additions & 157 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
.prettierrc
.prettierignore
.nojekyll
vite.config.ts
vitest.config.ts
docker-compose.yaml
Dockerfile
CODEOWNERS
Expand Down
19 changes: 12 additions & 7 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ import { fileURLToPath } from 'node:url';
import js from '@eslint/js';
import { FlatCompat } from '@eslint/eslintrc';

const _filename = fileURLToPath(import.meta.url);
const _dirname = path.dirname(_filename);
const compat = new FlatCompat({
baseDirectory: _dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export function createESLintCompat() {
const _filename = fileURLToPath(import.meta.url);
const _dirname = path.dirname(_filename);

return new FlatCompat({
baseDirectory: _dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
}

const compat = createESLintCompat();

export default [
{
Expand Down
20 changes: 20 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^12.1.10",
"@types/eslint__eslintrc": "^2.1.2",
"@types/inquirer": "^9.0.7",
"@types/jest": "^26.0.24",
"@types/js-cookie": "^3.0.6",
Expand Down
19 changes: 19 additions & 0 deletions src/createESLint.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { createESLintCompat } from '../eslint.config.mjs';
import { FlatCompat } from '@eslint/eslintrc';

describe('createESLintCompat', () => {
it('should initialize FlatCompat with the correct configuration', () => {
const compat = createESLintCompat();

expect(compat).toBeDefined();
expect(compat).toHaveProperty('baseDirectory');
expect(compat).toHaveProperty('recommendedConfig');
expect(compat).toHaveProperty('allConfig');
});

it('should return a valid FlatCompat instance', () => {
const compat = createESLintCompat();

expect(compat instanceof FlatCompat).toBe(true);
});
});
40 changes: 0 additions & 40 deletions src/eslint.config.spec.mjs

This file was deleted.

0 comments on commit 80067b5

Please sign in to comment.