1.0.6 • Published 13 days ago

eslint-plugin-jshow v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
13 days ago

pro-ci pro-co pro-dm pro-ver

pro-lic pro-ct


Supporting

jShow is an MIT-Licensed open source project with its ongoing development made possible entirely by the support of these awesome backers. If you'd like to join them, please consider:

What's the difference between Patreon and OpenCollective?

Funds donated via Patreon go directly to support eslint-plugin-jshow You's full-time work on jShow. Funds donated via OpenCollective are managed with transparent expenses and will be used for compensating work and expenses for core team members or sponsoring community events. Your name/logo will receive proper recognition and exposure by donating on either platform.


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.

    	```ts
    	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 properties

    	```ts
    	enum StaticAccessibility {
    		// off explicit
    		"off",
    		// explicit accessibility
    		"explicit",
    		// [default] explicit accessibility and remove accessibility, 
    		"no-accessibility"
    	}
    	```
  • fixWith: When accessibility is empty, use fixWith filled

    	```ts
    	enum FixWith {
    		"private",
    		"protected", // [default]
    		"public"
    	}
    	```
  • ignoredNames: When explicit accessibility is error, ignore these names

  • overrides: Override default accessibility for specific names

    	- Specific names:
    		- `constructors`: Override accessibility for constructors, default is `no-public`
    		- `parameterProperties`: Override accessibility for parameter properties, default is `explicit` and `fixWith` is `public`
    		- `properties`: Override accessibility for properties / fields, default is `off`
    		- `accessors`: Override accessibility for accessors, default is `explicit`
    		- `methods`: Override accessibility for methods, default is `explicit`
    
    	- Allows simple configuration, just like `accessibility`.
    
    	- Advanced usage has the following options:
    
    		```ts
    		{
    			accessibility: 'explicit';
    			fixWith: AccessibilityFixWith;
    			ignoredNames?: string[];
    		}
    		// or
    		{
    			accessibility: 'no-public';
    			ignoredNames?: string[];
    		}
    		```

Folder

──
 └── dist            // output folder
 └── src             // source folder
 │ └── index.js      // main script file
 │ └── rules         // eslint rules folder
 └── test            // mocha test folder


Questions

The issue list of this repo is exclusively for bug reports and feature requests.


License

MIT


Copyright (c) 2022 jShow.org