
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
@thyi/eslint-config
Advanced tools
A comprehensive, modern ESLint configuration for JavaScript and TypeScript projects with React support
This package provides two specialized configurations:
@typescript-eslint
eslint-plugin-import
and eslint-import-resolver-typescript
pnpm add -D @thyi/eslint-config
npm install --save-dev @thyi/eslint-config
yarn add --dev @thyi/eslint-config
bun add --dev @thyi/eslint-config
For Node.js projects, backend APIs, CLI tools, or any non-React JavaScript/TypeScript project:
// eslint.config.js
import config from '@thyi/eslint-config'
export default config
For React applications, React Native projects, or any project using React:
// eslint.config.js
import config from '@thyi/eslint-config/react'
export default config
Project Type | Use | Example |
---|---|---|
Node.js APIs | Default | import config from '@thyi/eslint-config' |
CLI Tools | Default | import config from '@thyi/eslint-config' |
Backend Services | Default | import config from '@thyi/eslint-config' |
Browser Libraries | Default | import config from '@thyi/eslint-config' |
Vanilla JS/TS Apps | Default | import config from '@thyi/eslint-config' |
Build Tools/Scripts | Default | import config from '@thyi/eslint-config' |
React Web Apps | React | import config from '@thyi/eslint-config/react' |
Next.js Apps | React | import config from '@thyi/eslint-config/react' |
React Native Apps | React | import config from '@thyi/eslint-config/react' |
Expo Apps | React | import config from '@thyi/eslint-config/react' |
Simple rule: Use React config for React projects, Default config for everything else.
Both configurations include full TypeScript support. You must have a tsconfig.json
file in your project root:
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022"],
"module": "NodeNext",
"moduleResolution": "NodeNext",
"allowJs": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
},
"include": [
"src/**/*",
"tests/**/*",
"*.config.js",
"*.config.ts"
],
"exclude": ["node_modules", "dist"]
}
Add these scripts to your package.json
:
{
"scripts": {
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint:check": "eslint . --max-warnings 0"
}
}
To override or extend rules:
// For Non-React projects
import baseConfig from '@thyi/eslint-config'
export default [
...baseConfig,
{
rules: {
// Override specific rules
'no-console': 'error',
'@typescript-eslint/no-unused-vars': 'error',
}
}
]
// For React projects
import baseConfig from '@thyi/eslint-config/react'
export default [
...baseConfig,
{
rules: {
// Override specific rules
'no-console': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'react-native/no-inline-styles': 'off'
}
}
]
The configuration includes intelligent overrides for different file types:
.tsx
, .jsx
) - React-specific rules enabled*.test.*
, *.spec.*
) - Relaxed rules for testing.js
, .cjs
, .mjs
) - TypeScript rules disabledThe configuration automatically ignores common build directories and files:
.expo/
.next/
build/
dist/
coverage/
html/
node_modules/
babel.config.js
metro.config.js
This ESLint configuration is Prettier-friendly but doesn't enforce Prettier formatting rules. Instead, it:
eslint-config-prettier
to turn off ESLint rules that conflict with PrettierUse any Prettier configuration format (.prettierrc.js
, prettier.config.js
, etc.) in your project root with your preferred settings:
{
"arrowParens": "always",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"semi": false,
"endOfLine": "lf",
"trailingComma": "all"
}
This approach gives you maximum flexibility while avoiding the performance overhead of running Prettier through ESLint.
Install the ESLint extension
Add these settings to your VS Code settings.json
:
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"[javascript][javascriptreact][typescript][typescriptreact]": {
"editor.formatOnSave": false
},
"eslint.useFlatConfig": true
}
ale
or nvim-lspconfig
with ESLint language serverflycheck-eslint
with flat config supportEnsure you're using ESLint v8.21.0 or higher and your config file is named eslint.config.js
.
Make sure your tsconfig.json
is valid and includes all TypeScript files you want to lint.
The config includes TypeScript and Node.js import resolvers. For custom path mapping, update your tsconfig.json
with proper paths
configuration.
For large projects, consider using projectService
in your TypeScript parser options or implementing incremental linting.
Using JavaScript config files (eslint.config.js
, vite.config.js
, etc.):
Ensure your tsconfig.json
includes JavaScript files and has allowJs: true
:
{
"compilerOptions": {
"allowJs": true,
// ... other options
},
"include": [
"src/**/*",
"tests/**/*",
"*.config.js", // Include config files
"*.config.ts" // Include TypeScript config files too
]
}
Alternative: Create a dedicated tsconfig.eslint.json
that extends your main config:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"allowJs": true
},
"include": [
"src/**/*",
"tests/**/*",
"eslint.config.js",
"vite.config.js",
"*.config.js"
]
}
Issues and pull requests are welcome! Please ensure your contributions:
MIT Β© Theodros Yimer
FAQs
ESLint Config for JavaScript, Typescript, React, React Native
We found that @thyi/eslint-config demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socketβs new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qixβs account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.