Skip to content

Commit

Permalink
build: update eslint config, prettier config, add jsdoc plugin (#2090)
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl authored Apr 20, 2024
1 parent 9a25636 commit df16325
Show file tree
Hide file tree
Showing 275 changed files with 3,398 additions and 3,166 deletions.
49 changes: 49 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* eslint-env node */
// @ts-check

/** @type {import("eslint").Linter.Config} */
const config = {
parser: "@typescript-eslint/parser",
ignorePatterns: ["**/*.css.d.ts", "dist", "build"],
plugins: ["@typescript-eslint", "jest"],
extends: [
"plugin:jest/recommended",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"prettier",
"plugin:prettier/recommended",
"plugin:import/recommended",
"plugin:import/typescript"
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
}
},
rules: {
"import/no-unresolved": "off",
"prettier/prettier": "warn",
"no-console": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-empty-interface": "warn",
"@typescript-eslint/no-explicit-any": "warn"
},
overrides: [
{
files: ["**/?(*.)+(spec|test).[jt]s?(x)"],
env: {
jest: true
},
extends: ["plugin:jest/recommended", "plugin:testing-library/react"],
rules: {
"testing-library/no-render-in-setup": "off",
"testing-library/no-node-access": "off",
"testing-library/render-result-naming-convention": "off",
"testing-library/no-render-in-lifecycle": "off"
}
}
]
};

module.exports = config;
48 changes: 0 additions & 48 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ignore-workspace-root-check=true
9 changes: 7 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"trailingComma": "none",
"$schema": "https://json.schemastore.org/prettierrc",
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true
"singleQuote": false,
"trailingComma": "none",
"plugins": [
"prettier-plugin-jsdoc"
]
}
22 changes: 11 additions & 11 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import type { Config } from '@jest/types';
import type { Config } from "@jest/types";

const config: Config.InitialOptions = {
preset: 'ts-jest',
roots: ['./src'],
preset: "ts-jest",
roots: ["./src"],
moduleNameMapper: {
'^test/(.*)': ['<rootDir>/test/$1'],
'^components(.*)': ['<rootDir>/src/components$1'],
'^contexts(.*)': ['<rootDir>/src/contexts$1'],
'^hooks(.*)': ['<rootDir>/src/hooks$1'],
'^types(.*)': ['<rootDir>/src/types$1']
"^test/(.*)": ["<rootDir>/test/$1"],
"^components(.*)": ["<rootDir>/src/components$1"],
"^contexts(.*)": ["<rootDir>/src/contexts$1"],
"^hooks(.*)": ["<rootDir>/src/hooks$1"],
"^types(.*)": ["<rootDir>/src/types$1"]
},
testEnvironment: 'jsdom',
coverageReporters: ['lcov', 'text', 'clover'],
setupFilesAfterEnv: ['./test/setup.ts']
testEnvironment: "jsdom",
coverageReporters: ["lcov", "text", "clover"],
setupFilesAfterEnv: ["./test/setup.ts"]
};

export default config;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"@types/node": "^20.10.5",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@types/testing-library__jest-dom": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^6.15.0",
"@typescript-eslint/parser": "^6.15.0",
"date-fns": "^3.0.6",
Expand All @@ -57,14 +56,15 @@
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-testing-library": "^6.2.0",
"eslint-plugin-testing-library": "^6.2.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"mockdate": "^3.0.5",
"postcss": "^8.4.32",
"postcss-d-ts": "^1.2.0",
"postcss-typescript-d-ts": "^1.0.0",
"prettier": "^3.1.1",
"prettier-plugin-jsdoc": "^1.3.0",
"react": "^18.2.0",
"react-classnaming": "^0.16.4",
"react-dom": "^18.2.0",
Expand Down
Loading

0 comments on commit df16325

Please sign in to comment.