Skip to content

Instantly share code, notes, and snippets.

@TCotton
Created February 25, 2026 21:26
Show Gist options
  • Select an option

  • Save TCotton/8d13104732367e7667ff7bc5dd510047 to your computer and use it in GitHub Desktop.

Select an option

Save TCotton/8d13104732367e7667ff7bc5dd510047 to your computer and use it in GitHub Desktop.
working eslint rule
import type { Linter } from 'eslint'
import js from '@eslint/js'
import tseslint from '@typescript-eslint/eslint-plugin'
import tsParser from '@typescript-eslint/parser'
import codegen from 'eslint-plugin-codegen'
import importPlugin from 'eslint-plugin-import'
import jsdoc from 'eslint-plugin-jsdoc'
import promisePlugin from 'eslint-plugin-promise'
import security from 'eslint-plugin-security'
import simpleImportSort from 'eslint-plugin-simple-import-sort'
import sortDestructureKeys from 'eslint-plugin-sort-destructure-keys'
const config: Linter.Config[] = [
js.configs.recommended,
{
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
plugins: {
'@typescript-eslint': tseslint as any,
codegen: codegen as any,
import: importPlugin,
jsdoc,
promise: promisePlugin,
security,
'simple-import-sort': simpleImportSort,
'sort-destructure-keys': sortDestructureKeys,
},
languageOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
parser: tsParser,
globals: {
console: 'readonly',
process: 'readonly',
__dirname: 'readonly',
__filename: 'readonly',
Buffer: 'readonly',
global: 'readonly',
},
},
rules: {
...importPlugin.configs.recommended.rules,
// Disable import/no-unresolved as TypeScript handles this
'import/no-unresolved': 'off',
// Disable import/named as TypeScript handles named exports
'import/named': 'off',
'no-console': ['warn', { allow: ['warn', 'error'] }],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
],
semi: ['error', 'never'],
'simple-import-sort/imports': 'error',
'simple-import-sort/exports': 'error',
'sort-destructure-keys/sort-destructure-keys': 'warn',
'import/first': 'error',
'import/newline-after-import': 'error',
'import/no-duplicates': 'error',
...promisePlugin.configs.recommended.rules,
'security/detect-object-injection': 'error',
'security/detect-non-literal-regexp': 'warn',
'security/detect-unsafe-regex': 'error',
'security/detect-buffer-noassert': 'error',
'security/detect-eval-with-expression': 'error',
'security/detect-no-csrf-before-method-override': 'error',
'security/detect-possible-timing-attacks': 'warn',
'jsdoc/check-alignment': 'warn',
'jsdoc/check-param-names': 'warn',
'jsdoc/check-tag-names': 'warn',
'jsdoc/check-types': 'warn',
'jsdoc/require-param-description': 'warn',
'jsdoc/require-returns-description': 'warn',
'max-lines': ['error', { max: 500, skipBlankLines: true, skipComments: true }],
},
},
{
files: ['**/*.test.ts', '**/*.spec.ts', '**/*.test.tsx', '**/*.spec.tsx'],
rules: {
'max-lines': 'off',
},
},
{
ignores: [
'**/node_modules/',
'**/dist/',
'**/.next/',
'**/coverage/',
'**/build/',
'**/frontend/next-env.d.ts',
'**/playwright-report/',
'**/test-results/',
],
},
]
export default config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment