https://github.com/krauters/eslint-config
This package provides eslint configuration as an extensible shared config.
https://github.com/krauters/eslint-config
dream eslint tslint typescript-eslint typescript-linting
Last synced: 7 months ago
JSON representation
This package provides eslint configuration as an extensible shared config.
- Host: GitHub
- URL: https://github.com/krauters/eslint-config
- Owner: krauters
- License: isc
- Created: 2024-06-19T02:51:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-13T01:06:15.000Z (8 months ago)
- Last Synced: 2025-04-19T23:45:16.434Z (7 months ago)
- Topics: dream, eslint, tslint, typescript-eslint, typescript-linting
- Language: JavaScript
- Homepage: https://npmjs.com/package/@krauters/eslint-config
- Size: 304 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README



[](https://www.npmjs.org/package/@krauters/eslint-config)







[](https://packagephobia.now.sh/result?p=@krauters/eslint-config)


# ESLint Config
This configuration integrates [ESLint](https://eslint.org/) and [TypeScript ESLint](https://typescript-eslint.io/), built to ensure clean, consistent, and maintainable code in JavaScript and TypeScript projects.
## Tenets
1. **Feedback Loops**: In DevOps, feedback loops are essential. Realtime linting gives developers instant insight, allowing faster fixes and smoother workflows. So, configure your IDE to provide linting feedback as you type.
2. **Code Consistency**: Linting ensures uniform coding standards across the team, reducing errors and enhancing collaboration by maintaining clarity and readability.
## Rules
All linting rules are defined in [rules.js](./rules.js). This configuration offers a strong foundation suitable for most projects, promoting code quality from the start while remaining flexible for customization.
## Usage
### Commands You Need
```zsh
# Check if your code passes lint rules
npm run lint
# Fix what can be auto-fixed
npm run fix
```
### Using this Lint Config in Your Project
1. Install the necessary dependencies:
```zsh
npm install @krauters/eslint-config --save-dev
```
1. Add a config file `eslint.config.js` to the root of your project with the following contents,
### ESM
```javascript
// eslint.config.js
import eslintConfig from '@krauters/eslint-config'
export default eslintConfig
```
### CommonJS
```javascript
// eslint.config.js
const eslintConfig = require('@krauters/eslint-config')
module.exports = eslintConfig
```
1. Add these npm scripts to your [package.json](./package.json),
```json
{
...
"scripts": {
"test": "npm run lint",
"lint": "npx eslint src/**",
"fix": "npm run lint -- --fix"
}
}
```
1. Update your README to show off your linting setup,
````zsh
## Lint
This package uses [@krauters/eslint-config](https://github.com/krauters/eslint-config).
```zsh
# Check if your code follows the rules
npm run lint
# Fix what can be auto-fixed
npm run fix
```
````
1. Now, let’s try it out.
```zsh
npm run lint
npm run fix
```
## Development
### Testing Locally
Want to test this linting config locally between two repos? Easy.
- **Repo1** is the ESLint config repo.
- **Repo2** is a JS/TS project using Repo1.
#### Steps
1. Clone both repos.
2. Link 'em up. From the root of Repo1, run:
```zsh
npm link
```
3. Then in Repo2, do this:
```zsh
npm link @krauters/eslint-config
```
4. When you’re done testing, unlink it with,
```zsh
npm unlink @krauters/eslint-config
```
### Setting Up Environment Variables
To control the behavior of how this package gets it's tsconfig file, you can set the following environment variables:
- `ESLINT_DEBUG`: Enables detailed debug logging. Set this to any truthy value, e.g., `1` or `true`.
- `ESLINT_TSCONFIG`: Overrides the default target file being searched. Defaults to `tsconfig.eslint.json`.
- `ESLINT_START_DIR`: Specifies the starting directory for the search. Defaults to the current working directory (`process.cwd()`).
- `ESLINT_TSCONFIG_FALLBACK`: Sets a fallback file to use if the target file is not found. Defaults to `tsconfig.json`.
### Debugging Tips
To troubleshoot your ESLint configuration, use the following commands:
```zsh
# Print the full ESLint config for a specific file that you want to lint
npx eslint --print-config test/auth-service.test.ts | grep tsconfig
# Enable debug logging while running ESLint
ESLINT_DEBUG=true npx eslint .
```
## Resources
- [TypeScript ESLint Playground](https://typescript-eslint.io/play)
## Contributing
The goal of this project is to continually evolve and improve its core features, making it more efficient and easier to use. Development happens openly here on GitHub, and we’re thankful to the community for contributing bug fixes, enhancements, and fresh ideas. Whether you're fixing a small bug or suggesting a major improvement, your input is invaluable.
## License
This project is licensed under the ISC License. Please see the [LICENSE](./LICENSE) file for more details.
## 🥂 Thanks Contributors
Thanks for spending time on this project.