For example:
// packages/eslint-config/package.json
{
"name": "@your-monorepo/eslint-config",
"version": "1.0.0",
"main": "index.js", // Or wherever your config file is
"dependencies": {
// These are the packages this config *provides* or *relies on*.
// If your config just exports rules, you might not need many here
// if the base configs/plugins are already installed at the root.
// Often, the actual ESLint and plugins are in peerDependencies.
},
"peerDependencies": {
"eslint": "*", // Or a specific range
"eslint-plugin-react": "*",
"eslint-plugin-import": "*",
// ... other plugins your config uses
},
"scripts": {
"test": "echo 'No tests for config package'"
}
}
Your actual config file (e.g., packages/eslint-config/index.js) would look something like this:
// packages/eslint-config/index.js
module.exports = {
// This config extends plugins that are expected to be installed
// in the root node_modules.
extends: [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:prettier/recommended", // If using prettier integration
],
plugins: [
"react",
"@typescript-eslint",
"import",
"prettier", // If using prettier integration
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
// For React/Vue etc. projects, you might need project config.
// project: "./tsconfig.json"
},
rules: {
// Your custom rules here
"react/react-in-jsx-scope": "off", // Example override
"@typescript-eslint/no-unused-vars": "warn", // Example override
},
settings: {
react: {
version: "detect",
},
},
};