@iwf-web/eslint-coding-standard
v1.1.0
Published
Standard eslint-coding-standard for IWF projects
Downloads
108
Readme
ESLint Coding Standard
A standardized ESLint configuration package for IWF projects. Built on top of @antfu/eslint-config, it provides an opinionated, pre-configured setup optimized for TypeScript and React applications.
Configurations
The package provides two configs:
- Standard TypeScript (
iwfWebStandardTs) — Full config with TypeScript strict checking, React, and all style rules. Use this for TypeScript projects. - Standard JavaScript (
iwfWebStandardJs) — Base config with React and style rules, without TypeScript. Use this for JS-only projects.
The TypeScript config extends the JavaScript one, so all JS/React rules are included automatically.
Both configs build on @antfu/eslint-config with the following customizations:
Code Style
- Semicolons: Required at statement ends
- Curly braces: Required for all control statements
- Arrow functions: Parentheses around single parameters
- Max line length: 120 characters (exceptions for comments, strings, and URLs)
- Object spacing: No spaces inside braces (
{foo: bar}) - Quote style: Single quotes, with object properties quoted only when required
TypeScript
- Strict type checking enabled with project-based tsconfig detection
- Allows promises in event handlers (e.g.,
onClick) - Relaxed
anytype restrictions for third-party library interoperability
React
- Full React support with hooks linting
- Allows common child manipulation patterns (
cloneElement,children.map, etc.) - Const declarations allowed for components
Disabled Features
- JSONC, YAML, and Markdown linting disabled
Getting Started
Prerequisites
- Node.js 18 or higher
- pnpm, npm, or yarn
Installation
pnpm add -D @iwf-web/eslint-coding-standardOr with npm:
npm install -D @iwf-web/eslint-coding-standardUsage
Create an eslint.config.js (or eslint.config.ts) file in your project root:
TypeScript projects
import { iwfWebStandardTs } from '@iwf-web/eslint-coding-standard';
export default iwfWebStandardTs();JavaScript-only projects
import { iwfWebStandardJs } from '@iwf-web/eslint-coding-standard';
export default iwfWebStandardJs();Subpath imports
Each config is also available as a direct subpath import:
import { iwfWebStandardTs } from '@iwf-web/eslint-coding-standard/standard-ts';
import { iwfWebStandardJs } from '@iwf-web/eslint-coding-standard/standard-js';With Custom Options
You can pass options to override the default configuration:
import { iwfWebStandardTs } from '@iwf-web/eslint-coding-standard';
export default iwfWebStandardTs({
typescript: {
tsconfigPath: './tsconfig.app.json',
},
});With Additional ESLint Configs
You can append additional ESLint flat config objects:
import { iwfWebStandardTs } from '@iwf-web/eslint-coding-standard';
export default iwfWebStandardTs(
{},
{
rules: {
'no-console': 'warn',
},
},
);Migration from v1
The function names have been updated to match the @iwf-web package scope:
iwfStandardTs→iwfWebStandardTsiwfStandardJs→iwfWebStandardJs
The old names still work but are deprecated and will be removed in the next major version.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
This project uses Conventional Commits for automated releases and changelog generation.
Versioning
We use SemVer for versioning. For available versions, see the tags on this repository.
Authors
Special thanks for all the people who had helped this project so far
- Manuele - D3strukt0r
See also the full list of contributors who participated in this project.
I would like to join this list. How can I help the project?
We're currently looking for contributions for the following:
- [ ] Bug fixes
- [ ] Translations
- [ ] etc...
For more information, please refer to our CONTRIBUTING.md guide.
License
This project is licensed under the MIT License - see the LICENSE.txt file for details.
Acknowledgments
This project currently uses no third-party libraries or copied code.
