Skip to content

Instantly share code, notes, and snippets.

@Nothing-Works
Last active August 26, 2025 12:59
Show Gist options
  • Select an option

  • Save Nothing-Works/239899334a220f413e7b02b19a5d0c27 to your computer and use it in GitHub Desktop.

Select an option

Save Nothing-Works/239899334a220f413e7b02b19a5d0c27 to your computer and use it in GitHub Desktop.
eslint react js/ts
npm install -D eslint prettier eslint-config-prettier globals eslint-plugin-prettier @eslint/js eslint-plugin-react eslint-plugin-react-hooks eslint-plugin-react-refresh @eslint-react/eslint-plugin prettier-plugin-organize-imports prettier-plugin-tailwindcss

for ts

npm install --save-dev typescript typescript-eslint

for vue

npm install -D eslint prettier globals @eslint/js eslint-plugin-vue @vue/eslint-config-prettier prettier-plugin-organize-imports prettier-plugin-tailwindcss
import js from '@eslint/js'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import prettierRecommended from 'eslint-plugin-prettier/recommended'
import reactPlugin from 'eslint-plugin-react'
import globals from 'globals'
import eslintReact from '@eslint-react/eslint-plugin'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
  globalIgnores(['dist']),
  {
    files: ['**/*.{js,jsx}'],
    extends: [
      js.configs.recommended,
      reactRefresh.configs.vite,
      reactPlugin.configs.flat.recommended,
      reactPlugin.configs.flat['jsx-runtime'],
      reactHooks.configs['recommended-latest'],
      eslintReact.configs.recommended,
      prettierRecommended,
    ],
    languageOptions: {
      ecmaVersion: 2020,
      globals: globals.browser,
      parserOptions: {
        ecmaVersion: 'latest',
        ecmaFeatures: { jsx: true },
        sourceType: 'module',
      },
    },
    rules: {
      'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
    },
    settings: {
      react: {
        version: 'detect',
      },
    },
  },
])


for ts

// @ts-check
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import eslintReact from '@eslint-react/eslint-plugin'
import reactPlugin from 'eslint-plugin-react'
import prettierRecommended from 'eslint-plugin-prettier/recommended'
import { globalIgnores } from 'eslint/config'

export default tseslint.config([
  globalIgnores(['dist']),
  {
    files: ['**/*.{ts,tsx}'],
    extends: [
      js.configs.recommended,
      tseslint.configs.recommendedTypeChecked,
      tseslint.configs.strictTypeChecked,
      tseslint.configs.stylisticTypeChecked,
      reactRefresh.configs.vite,
      reactPlugin.configs.flat.recommended,
      reactPlugin.configs.flat['jsx-runtime'],
      reactHooks.configs['recommended-latest'],
      eslintReact.configs['recommended-typescript'],
      prettierRecommended,
    ],
    languageOptions: {
      parser: tseslint.parser,
      parserOptions: {
        projectService: true,
        project: ['./tsconfig.node.json', './tsconfig.app.json'],
        tsconfigRootDir: import.meta.dirname,
      },
      ecmaVersion: 2020,
      globals: globals.browser,
    },
    settings: {
      react: {
        version: 'detect',
      },
    },
  },
])
// .prettierrc.json
{
  "$schema": "https://json.schemastore.org/prettierrc",
  "semi": false,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "es5",
  "printWidth": 100,
  "plugins": ["prettier-plugin-organize-imports", "prettier-plugin-tailwindcss"],
  "tailwindFunctions": ["clsx", "cn", "cva"],
  "tailwindStylesheet": "src/index.css"
}

for tailwind

  "editor.quickSuggestions": {
    "strings": "on"
  },
  "files.associations": {
    "*.jsx": "javascriptreact",
    "*.js": "javascript",
    "*.css": "tailwindcss"
  },
  "tailwindCSS.emmetCompletions": true,
  "tailwindCSS.includeLanguages": {
    "plaintext": "html"
  },
// jsconfig.json
{
"compilerOptions": {
  "jsx": "react-jsx",
  "checkJs": true,
  "paths": {
    "@/*": ["./src/*"]
  }
},
"include": ["**/*.js", "**/*.jsx"],
"exclude": ["node_modules", "dist"]
}

.editorconfig

root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
max_line_length = 100
import { defineConfig, globalIgnores } from 'eslint/config'
import globals from 'globals'
import js from '@eslint/js'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'

export default defineConfig([
  {
    name: 'app/files-to-lint',
    files: ['**/*.{js,mjs,jsx,vue}'],
  },

  globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),

  {
    languageOptions: {
      globals: {
        ...globals.browser,
      },
    },
  },

  js.configs.recommended,
  ...pluginVue.configs['flat/recommended'],
  skipFormatting,
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment