Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency eslint to v9 #7

Merged
merged 2 commits into from
Oct 26, 2024
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
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

11 changes: 0 additions & 11 deletions .eslintrc.cjs

This file was deleted.

1 change: 0 additions & 1 deletion app/src/components/ui/alert-dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';

import { buttonVariants } from '@/components/ui/button';
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as AvatarPrimitive from '@radix-ui/react-avatar';

import { cn } from '@/lib/utils';
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/checkbox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
import { Check } from 'lucide-react';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { X } from 'lucide-react';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
import { Check, ChevronRight, Circle } from 'lucide-react';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/form.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as LabelPrimitive from '@radix-ui/react-label';
import { Slot } from '@radix-ui/react-slot';
import {
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/hover-card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';

import { cn } from '@/lib/utils';
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/label.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as LabelPrimitive from '@radix-ui/react-label';
import { cva, type VariantProps } from 'class-variance-authority';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/popover.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as PopoverPrimitive from '@radix-ui/react-popover';

import { cn } from '@/lib/utils';
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/select.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as SelectPrimitive from '@radix-ui/react-select';
import { Check, ChevronDown, ChevronUp } from 'lucide-react';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/separator.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as SeparatorPrimitive from '@radix-ui/react-separator';

import { cn } from '@/lib/utils';
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/toggle-group.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
import { type VariantProps } from 'class-variance-authority';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as TogglePrimitive from '@radix-ui/react-toggle';
import { cva, type VariantProps } from 'class-variance-authority';

Expand Down
1 change: 0 additions & 1 deletion app/src/components/ui/tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
// eslint-disable-next-line import/no-namespace
import * as TooltipPrimitive from '@radix-ui/react-tooltip';

import { cn } from '@/lib/utils';
Expand Down
5 changes: 3 additions & 2 deletions app/tailwind.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('tailwindcss').Config} */

const plugin = require('tailwindcss/plugin');
import tailwindcssAnimate from 'tailwindcss-animate';
import plugin from 'tailwindcss/plugin';

module.exports = {
content: [
Expand All @@ -12,7 +13,7 @@ module.exports = {
],
darkMode: ['class'],
plugins: [
require('tailwindcss-animate'),
tailwindcssAnimate,
plugin(({ addUtilities }) => {
addUtilities({
'.no-scrollbar': {
Expand Down
187 changes: 187 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
/**
* Based off https://github.com/nkzw-tech/eslint-config - MIT License - Copyright (c) 2023 Christoph Nakazawa
* Dropped @nkzw/strict (no-instanceof), replaced `typescript-sort-keys` with `perfectionist`, and migrated
* to eslint 9 via @eslint/migrate-config.
*
* The plan is to switch to a pre-made config that supports Eslint 9, or look at a tool like Biome.
*/
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { fixupConfigRules, fixupPluginRules } from '@eslint/compat';
import { FlatCompat } from '@eslint/eslintrc';
import js from '@eslint/js';
import typescriptEslint from '@typescript-eslint/eslint-plugin';
import tsParser from '@typescript-eslint/parser';
import _import from 'eslint-plugin-import';
import noOnlyTests from 'eslint-plugin-no-only-tests';
import perfectionist from 'eslint-plugin-perfectionist';
import react from 'eslint-plugin-react';
import reactHooks from 'eslint-plugin-react-hooks';
import sortDestructureKeys from 'eslint-plugin-sort-destructure-keys';
import sortKeysFix from 'eslint-plugin-sort-keys-fix';
import unicorn from 'eslint-plugin-unicorn';
import unusedImports from 'eslint-plugin-unused-imports';
import globals from 'globals';

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

export default [
{
ignores: ['**/dist/', '**/coverage/', '**/generated/'],
},
...fixupConfigRules(
compat.extends(
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/strict',
'plugin:import/errors',
'plugin:import/typescript',
'plugin:react-hooks/recommended',
'plugin:react/recommended',
),
),
{
languageOptions: {
ecmaVersion: 5,

globals: {
...globals.browser,
...globals.node,
},
parser: tsParser,
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},

sourceType: 'commonjs',
},

plugins: {
'@typescript-eslint': fixupPluginRules(typescriptEslint),
import: fixupPluginRules(_import),
'no-only-tests': noOnlyTests,
perfectionist,
react: fixupPluginRules(react),
'react-hooks': fixupPluginRules(reactHooks),
'sort-destructure-keys': sortDestructureKeys,
'sort-keys-fix': sortKeysFix,
unicorn,
'unused-imports': unusedImports,
},

rules: {
'@typescript-eslint/ban-ts-comment': 0,
'@typescript-eslint/no-dynamic-delete': 0,
'@typescript-eslint/no-invalid-void-type': 0,
'@typescript-eslint/no-namespace': 0,
'@typescript-eslint/no-non-null-assertion': 0,
'@typescript-eslint/no-this-alias': 0,
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-var-requires': 0,
curly: 2,
'import/default': 0,
'import/named': 0,
'import/namespace': 0,
'import/no-duplicates': 0,
'import/no-extraneous-dependencies': 2,
'import/no-named-as-default-member': 0,
'import/order': 0,
'no-console': 2,
'no-const-assign': 2,
'no-constant-binary-expression': 2,
'no-extra-parens': [2, 'functions'],
'no-irregular-whitespace': 2,
'no-only-tests/no-only-tests': 2,
'no-this-before-super': 2,
'no-unused-expressions': 2,
'no-unused-labels': 2,
'no-unused-vars': 0,
'no-useless-rename': 2,
'no-var': 2,

'no-warning-comments': [
2,
{
terms: ['@nocommit'],
},
],

'object-curly-spacing': 0,
'object-shorthand': 2,

'perfectionist/sort-enums': 2,

'perfectionist/sort-interfaces': 2,
'prefer-arrow-callback': [
2,
{
allowNamedFunctions: true,
},
],
'prefer-const': 2,
'react-hooks/exhaustive-deps': 2,
'react/jsx-sort-props': 2,
'react/prop-types': 0,
'react/react-in-jsx-scope': 0,
'sort-destructure-keys/sort-destructure-keys': 2,
'sort-keys-fix/sort-keys-fix': 2,
'unicorn/better-regex': 2,
'unicorn/catch-error-name': 2,
'unicorn/consistent-empty-array-spread': 2,
'unicorn/consistent-function-scoping': 2,
'unicorn/no-abusive-eslint-disable': 2,
'unicorn/no-hex-escape': 2,
'unicorn/no-invalid-fetch-options': 2,
'unicorn/no-length-as-slice-end': 2,
'unicorn/no-magic-array-flat-depth': 2,
'unicorn/no-typeof-undefined': 2,
'unicorn/no-unnecessary-polyfills': 2,
'unicorn/no-useless-promise-resolve-reject': 2,
'unicorn/no-useless-spread': 2,
'unicorn/numeric-separators-style': 2,
'unicorn/prefer-array-flat-map': 2,
'unicorn/prefer-array-index-of': 2,
'unicorn/prefer-array-some': 2,
'unicorn/prefer-at': 2,
'unicorn/prefer-dom-node-append': 2,
'unicorn/prefer-native-coercion-functions': 2,
'unicorn/prefer-node-protocol': 2,
'unicorn/prefer-number-properties': 2,
'unicorn/prefer-optional-catch-binding': 2,
'unicorn/prefer-set-size': 2,
'unicorn/prefer-string-raw': 2,
'unicorn/prefer-string-replace-all': 2,
'unicorn/prefer-string-slice': 2,
'unicorn/prefer-structured-clone': 2,
'unicorn/prefer-ternary': 2,
'unicorn/prefer-top-level-await': 2,
'unicorn/text-encoding-identifier-case': 2,
'unused-imports/no-unused-imports': 2,
},

settings: {
'import/parsers': {
'@typescript-eslint/parser': ['.ts', '.tsx'],
},

'import/resolver': {
alias: {
extensions: ['.js', '.jsx', '.ts', '.tsx'],
map: [['@', './app/src']],
},
},

react: {
version: '18.2.0',
},
},
},
];
39 changes: 27 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,37 @@
"pnpm": ">=7.1.0"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"@nkzw/eslint-config": "^1.14.0",
"@swc/core": "^1.4.2",
"@types/node": "^20.11.24",
"autoprefixer": "^10.4.18",
"eslint": "^8.57.0",
"@eslint/compat": "^1.2.1",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.13.0",
"@ianvs/prettier-plugin-sort-imports": "^4.3.1",
"@swc/core": "^1.7.40",
"@types/node": "^20.17.1",
"@typescript-eslint/eslint-plugin": "^8.11.0",
"@typescript-eslint/parser": "^8.11.0",
"autoprefixer": "^10.4.20",
"eslint-import-resolver-alias": "^1.1.2",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-no-only-tests": "^3.3.0",
"eslint-plugin-perfectionist": "^3.9.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-sort-destructure-keys": "^2.0.0",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"eslint-plugin-unicorn": "^56.0.0",
"eslint-plugin-unused-imports": "^4.1.4",
"eslint": "^9.13.0",
"globals": "^15.11.0",
"npm-run-all2": "^7.0.0",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"prettier-plugin-tailwindcss": "^0.6.0",
"postcss": "^8.4.47",
"prettier-plugin-tailwindcss": "^0.6.8",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3",
"vite": "^5.1.4",
"vitest": "^2.0.0"
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vitest": "^2.1.3"
},
"scripts": {
"preinstall": "command -v git >/dev/null 2>&1 && git config core.hooksPath git-hooks || true",
Expand Down
Loading