eslint-plugin-sweepit
raw JSON → 0.0.23 verified Fri May 01 auth: no javascript
Opinionated architectural ESLint rules for TypeScript projects with React support. Current stable version 0.0.23, updated irregularly. Ships type definitions. Requires ESLint ^9.0.0 and TypeScript >=5.0.0. Key differentiators: prescriptive flat configs (core and React) that bundle recommended TypeScript-ESLint rules, functional programming rules, and custom rules for naming conventions (e.g., no TitleCase/titleCase props, no custom kebab-case props, restrict set* prefix to useState setters). Automatically enables TypeScript project service for type-aware rules. Focused on enforcing consistent prop naming and architectural boundaries.
Common errors
error Failed to load plugin 'eslint-plugin-sweepit': Cannot find module 'eslint-plugin-sweepit' ↓
cause Package not installed or missing dependencies.
fix
Run
npm install --save-dev eslint-plugin-sweepit eslint typescript. error ESLint couldn't determine the plugin for rule 'sweepit/no-array-props' ↓
cause Plugin not included in flat config or loaded incorrectly.
fix
Import sweepit and spread configs into the config array:
import sweepit from 'eslint-plugin-sweepit'; export default [...sweepit.configs.core]; error TypeError: Cannot read properties of undefined (reading 'core') ↓
cause Default export used incorrectly (e.g., named import).
fix
Use default import:
import sweepit from 'eslint-plugin-sweepit';. Warnings
breaking ESLint 9 flat config required. Legacy .eslintrc format is not supported. ↓
fix Migrate to flat config (eslint.config.js). See ESLint migration guide.
gotcha configs.core and configs.react enable TypeScript projectService by default, which can slow down linting on large projects. ↓
fix Disable projectService in parserOptions if performance is an issue: set parserOptions.projectService to false.
deprecated Rule naming may change in future major versions; currently uses kebab-case in the rule key but title-case in documentation references. ↓
fix Use consistent kebab-case rule keys as specified in the plugin.
Install
npm install eslint-plugin-sweepit yarn add eslint-plugin-sweepit pnpm add eslint-plugin-sweepit Imports
- default wrong
const sweepit = require('eslint-plugin-sweepit')correctimport sweepit from 'eslint-plugin-sweepit' - configs wrong
import { configs } from 'eslint-plugin-sweepit'correctimport sweepit from 'eslint-plugin-sweepit'; sweepit.configs.core - rules wrong
import { rules } from 'eslint-plugin-sweepit'correctimport sweepit from 'eslint-plugin-sweepit'; sweepit.rules['no-array-props']
Quickstart
// eslint.config.js
import sweepit from 'eslint-plugin-sweepit';
export default [
...sweepit.configs.core,
...sweepit.configs.react,
{
rules: {
'sweepit/no-array-props': 'warn',
'sweepit/no-prefixed-prop-bundles': ['error', { threshold: 4 }],
},
},
];