eslint-plugin-nextfriday
v1.21.0
Published
A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.
Maintainers
Readme
eslint-plugin-nextfriday
A comprehensive ESLint plugin providing custom rules and configurations for Next Friday development workflows.
Installation
npm install --save-dev eslint-plugin-nextfriday
# or
yarn add --dev eslint-plugin-nextfriday
# or
pnpm add -D eslint-plugin-nextfridayUsage
Flat Config (ESLint 9+)
Base Configuration (for pure JS/TS projects)
import nextfriday from "eslint-plugin-nextfriday";
export default [nextfriday.configs.base];
// or use the recommended preset (stricter)
export default [nextfriday.configs["base/recommended"]];React Configuration
import nextfriday from "eslint-plugin-nextfriday";
export default [nextfriday.configs.react];
// or use the recommended preset
export default [nextfriday.configs["react/recommended"]];Next.js Configuration
import nextfriday from "eslint-plugin-nextfriday";
export default [nextfriday.configs.nextjs];
// or use the recommended preset
export default [nextfriday.configs["nextjs/recommended"]];Bundled Plugin Configs
Pre-configured configs for popular plugins. No extra install needed — they ship as dependencies. These configs are arrays, so use the spread operator (...) to merge them into your flat config.
import nextfriday from "eslint-plugin-nextfriday";
export default [nextfriday.configs["react/recommended"], ...nextfriday.configs.sonarjs, ...nextfriday.configs.unicorn];| Config | Plugin | Description |
| --------- | --------------------- | ---------------------------------------------------------------------------------------------------------- |
| sonarjs | eslint-plugin-sonarjs | SonarJS recommended rules for bug detection and code quality |
| unicorn | eslint-plugin-unicorn | Unicorn recommended rules (with filename-case and prevent-abbreviations off, no-null off in JSX/TSX) |
Manual Configuration
If you prefer to configure rules manually:
import nextfriday from "eslint-plugin-nextfriday";
export default [
{
plugins: {
nextfriday,
},
rules: {
// Variable Naming
"nextfriday/no-single-char-variables": "error",
"nextfriday/no-lazy-identifiers": "error",
"nextfriday/boolean-naming-prefix": "error",
"nextfriday/enforce-constant-case": "error",
// File Naming
"nextfriday/file-kebab-case": "error",
"nextfriday/jsx-pascal-case": "error",
"nextfriday/md-filename-case-restriction": "error",
// Code Style
"nextfriday/no-emoji": "error",
"nextfriday/prefer-destructuring-params": "error",
"nextfriday/prefer-function-declaration": "error",
"nextfriday/require-explicit-return-type": "error",
"nextfriday/no-complex-inline-return": "error",
"nextfriday/no-logic-in-params": "error",
"nextfriday/enforce-hook-naming": "error",
"nextfriday/enforce-service-naming": "error",
"nextfriday/enforce-sorted-destructuring": "error",
"nextfriday/no-env-fallback": "error",
"nextfriday/no-inline-default-export": "error",
"nextfriday/newline-after-multiline-block": "error",
"nextfriday/newline-before-return": "error",
"nextfriday/no-inline-nested-object": "error",
"nextfriday/prefer-async-await": "error",
"nextfriday/enforce-curly-newline": "error",
"nextfriday/no-nested-ternary": "error",
"nextfriday/prefer-guard-clause": "error",
// Import Optimization
"nextfriday/no-relative-imports": "error",
"nextfriday/prefer-import-type": "error",
"nextfriday/prefer-react-import-types": "error",
"nextfriday/sort-exports": "error",
"nextfriday/sort-imports": "error",
// Type Patterns
"nextfriday/enforce-type-declaration-order": "error",
"nextfriday/no-nested-interface-declaration": "error",
"nextfriday/prefer-named-param-types": "error",
"nextfriday/prefer-inline-literal-union": "error",
"nextfriday/prefer-inline-type-export": "error",
"nextfriday/prefer-interface-over-inline-types": "error",
"nextfriday/sort-type-alphabetically": "error",
"nextfriday/sort-type-required-first": "error",
// React/JSX
"nextfriday/jsx-newline-between-elements": "error",
"nextfriday/jsx-no-inline-object-prop": "error",
"nextfriday/jsx-no-newline-single-line-elements": "error",
"nextfriday/jsx-no-non-component-function": "error",
"nextfriday/jsx-no-ternary-null": "error",
"nextfriday/jsx-no-variable-in-callback": "error",
"nextfriday/jsx-require-suspense": "error",
"nextfriday/jsx-simple-props": "error",
"nextfriday/jsx-sort-props": "error",
"nextfriday/prefer-jsx-template-literals": "error",
"nextfriday/react-props-destructure": "error",
"nextfriday/enforce-props-suffix": "error",
"nextfriday/enforce-readonly-component-props": "error",
// Next.js
"nextfriday/nextjs-require-public-env": "error",
},
},
];Note: This plugin requires ESLint 9+ and only supports the flat config format. Legacy
.eslintrcconfigurations are not supported.
Rules
Variable Naming Rules
| Rule | Description | Fixable |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------- | ------- |
| no-single-char-variables | Disallow single character variable names (e.g., d, u, l) | ❌ |
| no-lazy-identifiers | Disallow lazy identifiers like xxx, asdf, qwerty | ❌ |
| boolean-naming-prefix | Enforce boolean variables to have prefix (is, has, should, can, etc.) | ❌ |
| enforce-camel-case | Ban snake_case and restrict PascalCase to React components | ❌ |
| enforce-constant-case | Enforce SCREAMING_SNAKE_CASE for global static constant values | ❌ |
| enforce-property-case | Enforce camelCase for unquoted object property keys | ❌ |
| no-misleading-constant-case | Disallow SCREAMING_SNAKE_CASE in local scope and for dynamic values | ❌ |
File Naming Rules
| Rule | Description | Fixable | | -------------------------------------------------------------------------- | ---------------------------------------------------- | ------- | | file-kebab-case | Enforce kebab-case filenames for .ts and .js files | ❌ | | jsx-pascal-case | Enforce PascalCase filenames for .jsx and .tsx files | ❌ | | md-filename-case-restriction | Enforce SNAKE_CASE filenames for .md files | ❌ |
Code Style Rules
| Rule | Description | Fixable | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------- | ------- | | no-emoji | Disallow emoji characters in source code | ❌ | | prefer-destructuring-params | Enforce destructuring for functions with multiple parameters | ❌ | | prefer-function-declaration | Enforce function declarations over arrow functions in .ts files | ❌ | | require-explicit-return-type | Require explicit return types on functions for better documentation | ❌ | | no-complex-inline-return | Disallow complex inline expressions in return - extract to const first | ❌ | | no-logic-in-params | Disallow logic/conditions in function parameters - extract to const | ❌ | | enforce-hook-naming | Enforce 'use' prefix for functions in *.hook.ts files | ❌ | | enforce-service-naming | Enforce 'fetch' prefix for async functions in *.service.ts files | ❌ | | enforce-sorted-destructuring | Enforce alphabetical sorting of destructured properties | ✅ | | no-env-fallback | Disallow fallback values for environment variables | ❌ | | no-inline-default-export | Disallow inline default exports - declare first, then export | ❌ | | no-direct-date | Disallow direct usage of Date constructor and methods | ❌ | | newline-after-multiline-block | Require a blank line after multi-line statements | ✅ | | newline-before-return | Require a blank line before return statements | ✅ | | no-inline-nested-object | Require nested objects and arrays to span multiple lines | ✅ | | no-inline-return-properties | Require return object properties to use shorthand notation | ❌ | | prefer-async-await | Enforce async/await over .then() promise chains | ❌ | | enforce-curly-newline | Enforce curly braces for multi-line if, forbid for single-line | ✅ | | no-nested-ternary | Disallow nested ternary expressions | ❌ | | prefer-guard-clause | Enforce guard clause pattern instead of nested if statements | ❌ |
Import Optimization Rules
| Rule | Description | Fixable | | -------------------------------------------------------------------- | --------------------------------------------------------- | ------- | | no-relative-imports | Disallow relative imports with ../ - use absolute imports | ❌ | | prefer-import-type | Enforce using 'import type' for type-only imports | ✅ | | prefer-react-import-types | Enforce direct imports from 'react' instead of React.X | ✅ | | sort-exports | Enforce a consistent ordering of export groups | ✅ | | sort-imports | Enforce a consistent ordering of import groups | ✅ |
Type Pattern Rules
| Rule | Description | Fixable | | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | ------- | | enforce-type-declaration-order | Enforce referenced types are declared after their consumer | ❌ | | no-nested-interface-declaration | Disallow inline object types in interface/type properties | ❌ | | prefer-named-param-types | Enforce named types for function parameters with object types | ❌ | | prefer-inline-literal-union | Enforce inlining literal union types for better IDE hover info | ✅ | | prefer-inline-type-export | Require type/interface exports inline at the declaration | ✅ | | prefer-interface-over-inline-types | Enforce interface declarations over inline types for React props | ❌ | | sort-type-alphabetically | Enforce A-Z sorting of properties within type groups | ✅ | | sort-type-required-first | Enforce required properties before optional in types/interfaces | ✅ |
React/JSX Rules
| Rule | Description | Fixable | | ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | ------- | | jsx-newline-between-elements | Require empty lines between sibling multi-line JSX children | ✅ | | jsx-no-inline-object-prop | Disallow inline object literals in JSX props | ❌ | | jsx-no-newline-single-line-elements | Disallow empty lines between single-line sibling JSX elements | ✅ | | jsx-no-non-component-function | Disallow non-component functions at top level in .tsx/.jsx files | ❌ | | jsx-no-ternary-null | Enforce logical AND over ternary with null/undefined in JSX | ✅ | | jsx-no-variable-in-callback | Disallow variable declarations inside callback functions in JSX | ❌ | | jsx-require-suspense | Require lazy-loaded components to be wrapped in Suspense | ❌ | | jsx-simple-props | Enforce simple prop values (strings, variables, callbacks, ReactNode) | ❌ | | jsx-sort-props | Enforce JSX props are sorted by value type | ❌ | | prefer-jsx-template-literals | Enforce template literals instead of mixing text and JSX expressions | ✅ | | react-props-destructure | Enforce destructuring props inside React component body | ❌ | | enforce-props-suffix | Enforce 'Props' suffix for interfaces and types in *.tsx files | ❌ | | enforce-readonly-component-props | Enforce Readonly wrapper for React component props | ✅ |
Next.js Rules
| Rule | Description | Fixable | | -------------------------------------------------------------------- | ------------------------------------------------------------- | ------- | | nextjs-require-public-env | Require NEXTPUBLIC prefix for env vars in client components | ❌ |
Configurations
Configuration Presets Overview
| Preset | Severity | Base Rules | JSX Rules | Next.js Rules | Total Rules |
| -------------------- | -------- | ---------- | --------- | ------------- | ----------- |
| base | warn | 37 | 0 | 0 | 37 |
| base/recommended | error | 37 | 0 | 0 | 37 |
| react | warn | 37 | 15 | 0 | 52 |
| react/recommended | error | 37 | 15 | 0 | 52 |
| nextjs | warn | 37 | 15 | 1 | 53 |
| nextjs/recommended | error | 37 | 15 | 1 | 53 |
Base Configuration Rules (37 rules)
Included in base, base/recommended, and all other presets:
nextfriday/boolean-naming-prefixnextfriday/enforce-constant-casenextfriday/enforce-curly-newlinenextfriday/enforce-hook-namingnextfriday/enforce-service-namingnextfriday/enforce-sorted-destructuringnextfriday/enforce-type-declaration-ordernextfriday/file-kebab-casenextfriday/md-filename-case-restrictionnextfriday/newline-after-multiline-blocknextfriday/newline-before-returnnextfriday/no-complex-inline-returnnextfriday/no-direct-datenextfriday/no-emojinextfriday/no-env-fallbacknextfriday/no-inline-default-exportnextfriday/no-inline-nested-objectnextfriday/no-lazy-identifiersnextfriday/no-logic-in-paramsnextfriday/no-nested-interface-declarationnextfriday/no-nested-ternarynextfriday/no-relative-importsnextfriday/no-single-char-variablesnextfriday/prefer-async-awaitnextfriday/prefer-destructuring-paramsnextfriday/prefer-function-declarationnextfriday/prefer-guard-clausenextfriday/prefer-import-typenextfriday/prefer-inline-literal-unionnextfriday/prefer-inline-type-exportnextfriday/prefer-named-param-typesnextfriday/prefer-react-import-typesnextfriday/require-explicit-return-typenextfriday/sort-exportsnextfriday/sort-importsnextfriday/sort-type-alphabeticallynextfriday/sort-type-required-first
JSX Rules (15 rules)
Additionally included in react, react/recommended, nextjs, nextjs/recommended:
nextfriday/enforce-props-suffixnextfriday/enforce-readonly-component-propsnextfriday/jsx-newline-between-elementsnextfriday/jsx-no-inline-object-propnextfriday/jsx-no-newline-single-line-elementsnextfriday/jsx-no-non-component-functionnextfriday/jsx-no-ternary-nullnextfriday/jsx-no-variable-in-callbacknextfriday/jsx-pascal-casenextfriday/jsx-require-suspensenextfriday/jsx-simple-propsnextfriday/jsx-sort-propsnextfriday/prefer-interface-over-inline-typesnextfriday/prefer-jsx-template-literalsnextfriday/react-props-destructure
Next.js Only Rules (1 rule)
Additionally included in nextjs, nextjs/recommended only:
nextfriday/nextjs-require-public-env
Severity Levels
base/react/nextjs: All rules set to"warn"base/recommended/react/recommended/nextjs/recommended: All rules set to"error"
Features
- Variable naming enforcement: Prevent cryptic single-character names and enforce boolean prefixes
- File naming enforcement: Ensure consistent file naming conventions (kebab-case, PascalCase, SNAKE_CASE)
- Function style: Enforce function declarations over arrow functions in utility files
- Import optimization: Automatically suggests better import patterns for TypeScript
- Code cleanup: Helps remove unnecessary explicit type annotations
- React component conventions: Enforces naming standards and patterns for JSX/TSX files
- Clean code practices: Prevents emoji usage, enforces parameter destructuring, and more
- Formatting rules: Enforces consistent blank lines around multi-line blocks and return statements
Agent Skill
This plugin ships with an Agent Skill that teaches AI coding assistants (Claude Code, Cursor, etc.) all 53 rules so they generate compliant code from the start.
npx skills add next-friday/eslint-plugin-nextfriday --skill eslint-plugin-nextfridayOnce installed, AI assistants will automatically follow the naming, code style, type, JSX, import, and formatting patterns enforced by this plugin — reducing lint errors to zero.
Need Help?
If you encounter any issues or have questions:
- Check the rule documentation for detailed examples
- Report bugs or request features at: https://github.com/next-friday/eslint-plugin-nextfriday/issues
License
MIT
