Skip to content

Commit

Permalink
πŸ†™ eslint (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgarropy authored Dec 17, 2024
1 parent 1ab3cf3 commit f4ab14b
Show file tree
Hide file tree
Showing 7 changed files with 2,648 additions and 606 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22
127 changes: 64 additions & 63 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,94 +1,95 @@
import path from "node:path"
import {fileURLToPath} from "node:url"

import {includeIgnoreFile} from "@eslint/compat"
import js from "@eslint/js"
import prettier from "eslint-config-prettier"
import importSort from "eslint-plugin-simple-import-sort"
import vitest from "@vitest/eslint-plugin"
import jsxA11y from "eslint-plugin-jsx-a11y"
import react from "eslint-plugin-react"
import reactHooks from "eslint-plugin-react-hooks"
import simpleImportSort from "eslint-plugin-simple-import-sort"
import globals from "globals"
import tseslint from "typescript-eslint"
import ts from "typescript-eslint"

const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
const gitignore = path.resolve(dirname, ".gitignore")

const config = [
const config = ts.config([
includeIgnoreFile(gitignore),
{
ignores: ["build", "coverage"],
},
js.configs.recommended,
ts.configs.recommended,
react.configs.flat.recommended,
react.configs.flat["jsx-runtime"],
jsxA11y.flatConfigs.recommended,
{
files: [
"**/*.js",
"**/*.cjs",
"**/*.mjs",
"**/*.jsx",
"**/*.ts",
"**/*.cts",
"**/*.mts",
"**/*.tsx",
],

languageOptions: {
globals: {
...globals.browser,
...globals.node,
...globals.es2025,
...globals.jest,
...globals.es2021,
...globals.node,
},
parser: tseslint.parser,
parserOptions: {
ecmaFeatures: {},
project: "./tsconfig.json",
requireConfigFile: false,
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
sourceType: "module",
},
},
js.configs.recommended,
prettier,
{
plugins: {
"simple-import-sort": importSort,
"simple-import-sort": simpleImportSort,
"react-hooks": reactHooks,
"vitest": vitest,
},
settings: {
react: {
version: "19",
},
},
},
{
rules: {
"comma-dangle": ["error", "always-multiline"],
"comma-spacing": [
...reactHooks.configs.recommended.rules,
...vitest.configs.recommended.rules,
"@typescript-eslint/consistent-type-imports": [
"error",
{
before: false,
after: true,
prefer: "type-imports",
disallowTypeAnnotations: true,
fixStyle: "separate-type-imports",
},
],
"comma-style": ["error", "last"],
"eol-last": ["error", "always"],
"eqeqeq": ["error", "always"],
"function-paren-newline": ["off"],
"indent": ["off"],
"no-console": ["off"],
"no-mixed-spaces-and-tabs": ["error"],
"no-unused-vars": [
"@typescript-eslint/consistent-type-exports": ["error"],
"@typescript-eslint/no-import-type-side-effects": ["error"],
"@typescript-eslint/no-unused-vars": [
"error",
{
ignoreRestSiblings: true,
},
],
"object-curly-newline": [
"error",
{
consistent: true,
},
],
"object-curly-spacing": ["error", "never"],
"object-property-newline": [
"error",
{
allowAllPropertiesOnSameLine: true,
},
],
"eqeqeq": ["error", "always"],
"function-paren-newline": ["off"],
"indent": ["off"],
"jsx-a11y/accessible-emoji": ["off"],
"no-console": ["off"],
"prefer-const": ["error"],
"quote-props": ["error", "consistent-as-needed"],
"quotes": ["error", "double"],
"semi": ["error", "never"],
"semi-spacing": [
"error",
{
before: false,
after: true,
},
],
"semi-style": ["error", "last"],
"react-hooks/rules-of-hooks": ["error"],
"react-hooks/exhaustive-deps": ["error"],
"simple-import-sort/imports": ["error"],
"simple-import-sort/exports": ["error"],
"space-before-function-paren": [
"error",
{
anonymous: "never",
named: "never",
asyncArrow: "always",
},
],
},
},
]
])

export default config
Loading

0 comments on commit f4ab14b

Please sign in to comment.