Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions .eslintrc.js

This file was deleted.

163 changes: 163 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
const path = require('path')
const eslint = require('@eslint/js')
const tseslint = require('typescript-eslint')
const importPlugin = require('eslint-plugin-import')
const prettierPlugin = require('eslint-plugin-prettier/recommended')
const pluginVitest = require('@vitest/eslint-plugin')
const simpleImportSort = require('eslint-plugin-simple-import-sort')
const pluginReact = require('eslint-plugin-react')
const pluginReactHooks = require('eslint-plugin-react-hooks')
const jsxA11y = require('eslint-plugin-jsx-a11y')

module.exports = tseslint.config(
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
languageOptions: {
parser: tseslint.parser,
parserOptions: {
projectService: true,
tsconfigRootDir: __dirname,
ecmaFeatures: {
jsx: true,
},
},
},
settings: {
'import/resolver': {
typescript: {
project: path.join(__dirname, 'tsconfig.json'),
},
node: true,
},
react: {
version: 'detect',
},
},
},
eslint.configs.recommended,
tseslint.configs.recommendedTypeChecked,
importPlugin.flatConfigs.recommended,
importPlugin.flatConfigs.typescript,
pluginReact.configs.flat.recommended,
pluginReact.configs.flat['jsx-runtime'],
{
plugins: {
'react-hooks': pluginReactHooks,
},
rules: pluginReactHooks.configs.recommended.rules,
},
jsxA11y.flatConfigs.recommended,
{
name: 'vpp-tests',
files: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
...pluginVitest.configs.recommended,
rules: {
...pluginVitest.configs.recommended.rules,
'vitest/no-disabled-tests': 'warn',
'vitest/no-focused-tests': 'error',
'vitest/prefer-to-have-length': 'warn',
'jsx-a11y/anchor-has-content': 'off',
'jsx-a11y/no-static-element-interactions': 'off',
},
settings: {
vitest: {
typecheck: true,
},
languageOptions: {
globals: {
...pluginVitest.environments.env.globals,
},
},
},
},
prettierPlugin,
{
name: 'eslint-config-truepill/frontend',
plugins: { 'simple-import-sort': simpleImportSort },
rules: {
// These rules allow automatic nice-looking import sorting using --fix
'simple-import-sort/imports': 'warn',
'simple-import-sort/exports': 'warn',
'sort-imports': 'off',
'import/order': 'off',
// These are disabled for stylistic reasons
'no-console': [
'warn',
{
allow: ['info', 'warn', 'debug', 'error', 'exception'],
},
],
'no-void': [
'error',
{
allowAsStatement: true,
},
],
camelcase: 'off',
'@typescript-eslint/camelcase': 'off',
'@typescript-eslint/member-delimiter-style': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-use-before-define': 'error',
// This is disabled so it doesn't delete stuff on autofix
'no-unreachable': 'off',
// These are enabled for more strictness
'@typescript-eslint/no-useless-constructor': ['error'],
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/prefer-promise-reject-errors': 'off',
'import/no-named-as-default': 'off',
'import/no-named-as-default-member': 'off',
'no-var': 'error',
'prefer-rest-params': 'error',
'prefer-spread': 'error',
'react/jsx-uses-react': 'warn',
'react/jsx-uses-vars': 'warn',
'react/no-access-state-in-setstate': 'warn',
'react/no-unused-state': 'warn',
'react/prop-types': 'off',
// These rules are duplicated by Typescript rules
'no-array-constructor': 'off',
'no-empty-function': 'off',
'no-extra-semi': 'off',
'no-unused-vars': 'off',
'no-use-before-define': 'off',
'no-useless-constructor': 'off',
'require-await': 'off',
},
},
{
name: 'rum-react-integration',
rules: {
'@typescript-eslint/no-empty-interface': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/no-use-before-define': 'off',
// Disabled till anchor tag have fully been resolved
'jsx-a11y/anchor-is-valid': 'off',
'@typescript-eslint/no-floating-promises': 'off',
'max-len': ['error', { ignoreTemplateLiterals: true, ignoreStrings: true, code: 250 }],
'jsx-a11y/click-events-have-key-events': 'warn',
'@typescript-eslint/no-misused-promises': ['error', { checksVoidReturn: false }],
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/unbound-method': 'off',
'@typescript-eslint/restrict-template-expressions': 'off',
'@typescript-eslint/restrict-plus-operands': 'off',
'@typescript-eslint/no-restricted-imports': [
'warn',
{
paths: [
{
name: '@truepill/react-capsule',
importNames: ['Modal', 'Button', 'TextField', 'Select', 'Autocomplete'],
message: 'Use pre-styled version of this component.',
allowTypeImports: true,
},
],
},
],
},
},
)
24 changes: 0 additions & 24 deletions jest.config.ts

This file was deleted.

1 change: 0 additions & 1 deletion jest.setup.ts

This file was deleted.

61 changes: 35 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
"build": "run-p build:cjs build:esm",
"build:cjs": "rm -rf cjs && tsc -p tsconfig.cjs.json",
"build:esm": "rm -rf esm && tsc -p tsconfig.esm.json",
"format": "prettier --ignore-unknown --write src",
"lint": "eslint --fix src",
"lint": "eslint --flag unstable_config_lookup_from_file \"src/**/*.{ts,tsx}\"",
"lint:fix": "eslint --flag unstable_config_lookup_from_file --fix --max-warnings=0 \"src/**/*.{ts,tsx}\"",
"lint:fix:only": "eslint --fix --no-ignore --max-warnings=0 --flag unstable_config_lookup_from_file",
"format": "prettier --ignore-unknown --write .",
"format:check": "prettier -c",
"format:fix": "prettier -w",
"prepare": "run-s build",
"typecheck": "scripts/cli typecheck . && scripts/cli typecheck developer-extension",
"test": "jest",
"test:ci": "jest --ci",
"test:cov": "jest --coverage"
"test": "vitest",
"test:ci": "vitest -c vitest.config.ts"
},
"dependencies": {
"tslib": "^1.10.0"
Expand All @@ -32,39 +36,44 @@
},
"peerDependencies": {
"react": ">=16",
"react-router-dom": "^5.0.0"
"react-router": "^7.1.1"
},
"devDependencies": {
"@datadog/browser-rum-core": "^5.32.0",
"@eslint/js": "^9.25.1",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@swc/core": "^1.9.3",
"@swc/jest": "^0.2.37",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@truepill/eslint-config-truepill": "^5.0.3",
"@types/history": "^4",
"@types/jest": "^26.0.24",
"@types/node": "^22.10.1",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/react-router-dom": "^5.1.7",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"eslint": "7.32.0",
"@types/react": "^18",
"@types/react-dom": "^18",
"@vitejs/plugin-react-swc": "^3.7.2",
"@vitest/eslint-plugin": "^1.1.43",
"eslint": "9.25.1",
"eslint-config-prettier": "^10.1.2",
"eslint-plugin-import": "^2.31.0",
"eslint-import-resolver-typescript": "^4.3.4",
"eslint-import-resolver-node": "^0.3.9",
"eslint-plugin-jsx-a11y": "^6.10.2",
"eslint-plugin-prettier": "^5.2.6",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"history": "^4",
"jest": "^27.0.6",
"jest-junit": "^16.0.0",
"lefthook": "^1.10.10",
"npm-run-all": "^4.1.5",
"prettier": "2.2.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-router-dom": "^5.0.0",
"semantic-release": "^17.4.4",
"semantic-release-cli": "^5.4.3",
"ts-node": "10.8.2",
"typescript": "^4.3.5"
"prettier": "3.5.3",
"react": "^18",
"react-dom": "^18",
"react-router": "^7.1.1",
"unplugin-swc": "^1.4.4",
"vite": "^5.4.11",
"vite-plugin-svgr": "^4.3.0",
"vitest": "^1.6.0",
"typescript": "5.2.2",
"typescript-eslint": "^8.31.0"
}
}
Loading