@caredevi-suyog/eslint-config
v1.0.3
Published
Shared ESLint flat configuration (ESLint v9+) for CareDevi projects.
Readme
@caredevi/eslint-config
Shared ESLint flat configuration (ESLint v9+) for CareDevi projects.
Supported Environments
- JavaScript / TypeScript (general base)
- React (web)
- Next.js
- React Native (Expo)
- Node.js / backend
Note: This package is now published to npm: @caredevi-suyog/eslint-config
To install in your JavaScript/TypeScript project, simply run:
npm install @caredevi-suyog/eslint-config --save-dev
Table of Contents
- @caredevi/eslint-config
Features
- ESLint 9+ flat config
- Prettier integration (formatting via
eslint --fix) eslint-plugin-importwith ordered imports (import/order)unused-importsplugin for cleaning dead imports- TypeScript-aware rules via
@typescript-eslint - Framework-specific rules for React, Next.js, and React Native (Expo)
- Common opinionated rules:
eqeqeq,curly,prefer-const,no-var,no-console: warn, etc. - Browser + Node + serviceworker globals by default
Current Status
- Published! The config is available on npm as
@caredevi-suyog/eslint-config - Use the npm install method below for all new projects.
Installation
Install the config in your project using npm:
npm install @caredevi-suyog/eslint-config --save-devThen, create or update eslint.config.mjs (or .js) in your project root:
// eslint.config.mjs
import caredevi from '@caredevi-suyog/eslint-config/react'; // or /next, /reactnative, /node, or just base
export default [
...caredevi,
// Optional project-specific overrides
{
rules: {
'no-console': 'off', // example
},
},
];Entry Points
| Import path | Purpose |
| --------------------------------------------- | ------------------------------------------ |
| @caredevi-suyog/eslint-config | Base (JS/TS + Prettier + import/order) |
| @caredevi-suyog/eslint-config/react | React + React Hooks |
| @caredevi-suyog/eslint-config/next | Next.js (App Router & Pages) |
| @caredevi-suyog/eslint-config/reactnative | React Native (Expo) |
| @caredevi-suyog/eslint-config/node | Node.js / backend |
| @caredevi-suyog/eslint-config/prettier | Only Prettier config |
Usage Examples
React project
// eslint.config.mjs
import config from '@caredevi-suyog/eslint-config/react';
export default [...config];React Native project (MyCaredevi)
// eslint.config.mjs
import config from '@caredevi-suyog/eslint-config/reactnative';
export default [...config];Next.js project (EMR/RPM)
// eslint.config.mjs
import config from '@caredevi-suyog/eslint-config/next';
export default [...config];Node.js / Backend project (Caredevi Backend)
// eslint.config.mjs
import config from '@caredevi-suyog/eslint-config/node';
export default [...config];Recommended Scripts
Add the following to your project's package.json:
{
"scripts": {
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"format": "eslint . --ext .js,.jsx,.ts,.tsx --fix"
}
}VS Code Integration
Add the following to .vscode/settings.json in your project:
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"eslint.format.enable": true,
"[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[javascriptreact]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[typescript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" },
"[typescriptreact]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" }
}Development & Contributing
Inside the eslint-config-caredevi folder, run:
npm installChanges are immediately available in all linked projects after saving files.
Planned Improvements
- Publish to npm (
@caredevi/eslint-config) - Add Vitest / Jest test config preset
- Add stricter TypeScript type-aware rules option
- Separate config for legacy JavaScript projects (if needed)
- Better per-framework documentation
Publishing & Updating the npm Package
To update and publish a new version of @caredevi-suyog/eslint-config to npm, follow these steps:
1. Generate a Fine-Tuned npm Access Token
- Go to your npm account access tokens page.
- Click Create New Token → choose Automation (recommended for CI/CD) or Publish (for manual publishing).
- Copy the generated token. Keep it secret!
2. Add the Token to .npmrc
In the root of your project (or your home directory), add the following line to your .npmrc file:
//registry.npmjs.org/:_authToken=YOUR_TOKEN_HEREReplace YOUR_TOKEN_HERE with the token you generated above.
3. Login to npm (if needed)
If you haven't already, log in to npm in your terminal:
npm loginFollow the prompts for your username, password, and email. (If using a token in .npmrc, this step may be skipped.)
4. Bump the Version
Update the version field in package.json according to semver:
npm version patch # or minor/major as appropriate5. Publish the Package
Run:
npm publish --access publicIf successful, your new version will be available at https://www.npmjs.com/package/@caredevi-suyog/eslint-config
Versions
1.0.3
- No changes here either, just for keeping the version consistent
1.0.2
- No new changes, I don't know why but NPM made this this the latest version lol
1.0.1
- Updated: Moved all dependencies to peerDependencies for better compatibility.
- Added: Separate config for React Native to resolve lint config conflicts between Node and React Native packages.
1.0.0
- Initial release: Base, React, Next.js, Node, and Prettier configs.
License
MIT
