eslint-plugin-jshow
v1.0.13
Published
ESLint plugin for jshow
Downloads
632
Readme
Supporting
jShow is an MIT-licensed open-source project sustained entirely by generous backers. If you would like to join them:
- Sponsor via Patreon to fund the maintainer directly.
- Donate on Open Collective for transparent expense tracking that benefits contributors and community events.
Patreon vs. Open Collective
- Patreon contributions go straight to the maintainer behind eslint-plugin-jshow.
- Open Collective pools funds, publishes receipts, and reimburses work or events for the broader community.
- Both options publicly acknowledge your name/logo.
Overview
This monorepo delivers a full ESLint experience for TypeScript projects:
eslint-config-jshowextends industry-standard presets, applies Prettier alignment, and wires the custom rules automatically.eslint-plugin-jshowprovides specialized rules that enforce explicit accessibility, remove unused imports, and clean unused variables with safe autofixers.- React/Vue example apps showcase how the configuration behaves in real projects.
Repository Layout
├── packages/
│ ├── config/ # eslint-config-jshow sources
│ └── rule/ # eslint-plugin-jshow sources
├── scripts/ # Shared build helpers (ts-node entry points)
├── examples/
│ ├── react/ # React Tic-Tac-Toe demo using the rules
│ └── vue/ # Vue 3 demo using the rules
├── dist/ # Generated packages after build
└── ...Packages
eslint-config-jshow
Extendseslint:recommended,plugin:@typescript-eslint/recommended,prettier, andplugin:prettier/recommended, wires the in-house import/export sorting rules, and exposes flavor presets (browser,node,react,vue,import).eslint-plugin-jshow
Ships five rules with autofix support:explicit-member-accessibilitysort-exportsort-importunused-importunused-variable
Both packages are built with ts-node scripts and published from dist/.
Getting Started
Install
pnpm add -D eslint eslint-plugin-jshow eslint-config-jshowUse relative dist/ paths when consuming directly from the repository before publishing to npm.
Configure ESLint
Create eslint.config.js (ESLint 9 only reads flat configs) and import the preset you need:
import typescriptConfig from 'eslint-config-jshow';
export default [...typescriptConfig];Swap the import with eslint-config-jshow/react, eslint-config-jshow/vue, eslint-config-jshow/browser, or eslint-config-jshow/node depending on the runtime.
Run ESLint
pnpm exec eslint . --report-unused-disable-directives --max-warnings=0Scripts
| Command | Description |
| --- | --- |
| pnpm build | Clean existing artifacts, build packages/rule and packages/config, and write outputs to dist/. |
| pnpm test:rule | Run the Jest-based RuleTester suite for the plugin. |
| pnpm preview:react / pnpm preview:vue | Launch the Vite demos to validate lint feedback interactively. |
| pnpm test:react / pnpm test:vue | Run ESLint directly within the example projects. |
Each package also exposes npm run build, which the root build script invokes through ts-node.
Examples
React and Vue demos live under examples/ and reuse the local dist/ artifacts:
pnpm run preview:react # start Vite dev server for the React demo
pnpm run test:react # run ESLint on the React demo
pnpm run preview:vue
pnpm run test:vueFeel free to tweak these apps to observe how the rules behave in real scenarios.
Development Workflow
- Modify sources inside
packages/ruleorpackages/config. - Run
pnpm buildto regenerate the distributable artifacts (metadata such as{TARGET_NAME}/{TARGET_VERSION}is injected here). - Execute
pnpm test:ruleto keep the rule suite green. - Optionally open the example apps for a manual smoke test.
Questions
The issue tracker is exclusively for bug reports and feature requests.
Rules Details
explicit-member-accessibility
External eslint build-in rule (explicit-member-accessibility), allow custom accessibility with fix error code
** default rule options **
{
"plugins": ["jshow"],
"rules": {
"jshow/explicit-member-accessibility": [
"error",
{
"accessibility": "explicit",
"staticAccessibility": "no-accessibility",
"fixWith": "protected",
"overrides": {
"constructors": "no-public"
}
}
]
}
}accessibility: Set whether to detect accessibility for properties / fields / methods / constructors / parameter properties.enum Accessibility { // off explicit "off", // [default] explicit accessibility "explicit", // explicit accessibility and remove public accessibility "no-public" }staticAccessibility: Set whether to detect accessibility for static propertiesenum StaticAccessibility { // off explicit "off", // explicit accessibility "explicit", // [default] explicit accessibility and remove accessibility, "no-accessibility" }fixWith: When accessibility is empty, use [fixWith] filledenum FixWith { "private", "protected", // [default] "public" }ignoredNames: When explicit accessibility is error, ignore these namesoverrides: Override default accessibility for specific namesSpecific names:
constructors: Override accessibility for constructors, default isno-publicparameterProperties: Override accessibility for parameter properties, default isexplicitandfixWithispublicproperties: Override accessibility for properties / fields, default isoffaccessors: Override accessibility for accessors, default isexplicitmethods: Override accessibility for methods, default isexplicit
Allows simple configuration, just like
accessibility.Advanced usage has the following options:
{ accessibility: 'explicit'; fixWith: AccessibilityFixWith; ignoredNames?: string[]; } // or { accessibility: 'no-public'; ignoredNames?: string[]; }
sort-import
Keeps import declarations grouped and ordered deterministically, mirroring eslint-plugin-simple-import-sort while remaining inside the jshow plugin.
** default rule options **
{
"plugins": ["jshow"],
"rules": {
"jshow/sort-import": [
"error",
{
"autoFix": "always",
"order": "asc",
"groups": [
["^node:"],
["^\\u0000"],
["^@?[a-zA-Z]"],
["^@/"],
["^\\.\\./"],
["^\\./"]
],
"clusters": [0, 0, 0, 0, 0, 0]
}
]
}
}autoFix:"always"(default) rewrites misplaced imports and blank lines. Set to"off"to only report.order:"asc"(default) or"desc"determines how paths are sorted inside each group.groups: Array of RegExp string arrays. Each inner array represents a group and the first matching pattern wins. Any import that does not match a custom group is appended after the declared groups. A single blank line is always inserted between different groups.clusters: Mirrors thegroupsarray one-to-one and only affects spacing inside a group. Values0/1/2mean “keep compact”, “add one blank line below”, and “add one blank line both above and below”; any other number falls back to0. If the cluster padding meets the mandatory blank line between groups, the rule collapses the duplicate spacing back to a single blank line.
sort-export
Enforces deterministic ordering for batches of export { ... } from '...' and export * from '...' declarations, replacing eslint-plugin-simple-import-sort/exports with a native implementation.
** default rule options **
{
"plugins": ["jshow"],
"rules": {
"jshow/sort-export": [
"error",
{
"autoFix": "always",
"order": "asc"
}
]
}
}autoFix:"always"(default) rewrites misordered export declarations. Set to"off"to only report violations.order:"asc"(default) or"desc"controls how module specifiers and aliases are compared within the same export block.
unused-import
Automatically prunes import specifiers that never get referenced. When every specifier in a statement is unused the rule removes the entire import.
** default rule options **
{
"plugins": ["jshow"],
"rules": {
"jshow/unused-import": [
"warn",
{
"autoFix": "always",
"ignoredNames": ["^_"],
"ignoreJSDoc": true
}
]
}
}autoFix:"always"(default) deletes unused specifiers automatically. Set to"off"if you only need diagnostics.ignoredNames: members matching these names are always ignored. Supports exact string matching or regex patterns (e.g.,"^_"matches any identifier starting with underscore). Use this when_or other conventions mark intentionally unused imports.ignoreJSDoc:true(default) skips checking JSDoc comments for references. Set tofalseto consider JSDoc references (e.g.,@link,@see,@type) when determining if an import is used.
unused-variable
Targets unused variable declarations, including destructured bindings. The fixer removes the smallest range necessary (identifier, declarator, or whole statement) to keep the file syntactically valid.
** default rule options **
{
"plugins": ["jshow"],
"rules": {
"jshow/unused-variable": [
"warn",
{
"autoFix": "always",
"ignoredNames": ["^_"],
"ignoreFunction": true
}
]
}
}autoFix:"always"attempts to remove the unused declaration;"off"only reports.ignoredNames: whitelist of identifiers that should never trigger the rule. Supports exact string matching or regex patterns (e.g.,"^_"matches any identifier starting with underscore). Defaults to["^_"].ignoreFunction:true(default) ignores variables initialized with function expressions, call expressions, or await expressions. Set tofalseto also check and remove unused function variables. Note: variables in destructuring patterns are always checked regardless of this option.
License
Copyright (c) 2022 jShow.org
