eslint-plugin 0.0.2-20220512055634-f396a48
Install from the command line:
Learn more about npm packages
$ npm install @dimensiondev/eslint-plugin@0.0.2-20220512055634-f396a48
Install via package.json:
"@dimensiondev/eslint-plugin": "0.0.2-20220512055634-f396a48"
About this version
You'll first need to install eslint:
npm install --save-dev eslint
Next, install @dimensiondev/eslint-plugin
:
# for stable version
npm install --save-dev @dimensiondev/eslint-plugin
# for unstable version
npm install --save-dev @dimensiondev/eslint-plugin --registry=https://npm.dimension.im
Add @dimensiondev
to the plugins section of your .eslintrc
configuration file.
{
"$schema": "https://dimensiondev.github.io/eslint-plugin/src/schema.json",
"plugins": ["@dimensiondev"],
"rules": {
"@dimensiondev/array/no-implicit-sort": "error",
"@dimensiondev/array/no-unneeded-flat-map": "error",
"@dimensiondev/array/prefer-from": "error",
"@dimensiondev/browser/no-persistent-storage": "error",
"@dimensiondev/browser/no-set-html": "error",
"unicorn/prefer-dom-node-dataset": "off",
"@dimensiondev/browser/prefer-dataset": "error",
"unicorn/prefer-add-event-listener": "off",
"unicorn/no-invalid-remove-event-listener": "off",
"@dimensiondev/browser/prefer-event-target": "error",
"unicorn/prefer-keyboard-event-key": "off",
"@dimensiondev/browser/prefer-keyboard-event-key": "error",
"@dimensiondev/browser/prefer-location-assign": "error",
"unicorn/prefer-dom-node-append": "off",
"unicorn/prefer-dom-node-remove": "off",
"unicorn/prefer-modern-dom-apis": "off",
"@dimensiondev/browser/prefer-modern-dom-apis": "error",
"unicorn/prefer-query-selector": "off",
"@dimensiondev/browser/prefer-query-selector": "error",
"unicorn/prefer-dom-node-text-content": "off",
"@dimensiondev/browser/prefer-text-content": "error",
"@dimensiondev/jsx/no-class-component": "error",
"@dimensiondev/jsx/no-logical": "off",
"@dimensiondev/jsx/no-set-html": "error",
"@dimensiondev/jsx/no-template-literal": "error",
"@dimensiondev/jsx/no-unneeded-nested": "error",
"@dimensiondev/jsx/prefer-test-id": "off",
"@dimensiondev/string/no-data-url": "error",
"@dimensiondev/string/no-interpolation": "error",
"@dimensiondev/string/no-locale-case": "error",
"@dimensiondev/string/no-simple-template-literal": "error",
"@dimensiondev/string/no-unneeded-to-string": "error",
"@dimensiondev/type/no-bigint": "off",
"@dimensiondev/type/no-const-enum": "off",
"@dimensiondev/type/no-empty-literal": "off",
"@dimensiondev/type/no-force-cast-via-top-type": "error",
"unicorn/no-instanceof-array": "off",
"@dimensiondev/type/no-instanceof-wrapper": "error",
"@dimensiondev/type/no-number-constructor": "error",
"@dimensiondev/type/no-wrapper-type-reference": "error",
"@dimensiondev/type/prefer-return-type-annotation": "error",
"@dimensiondev/unicode/no-bidi": "off",
"@dimensiondev/unicode/no-invisible": "error",
"@dimensiondev/unicode/specific-set": "off",
"@dimensiondev/ban-eslint-disable": "error",
"@dimensiondev/no-builtin-base64": "error",
"@dimensiondev/no-default-error": "error",
"@dimensiondev/no-redundant-variable": "error",
"@dimensiondev/no-single-return": "error",
"@dimensiondev/no-then": "error",
"@dimensiondev/no-timer": "off",
"@dimensiondev/no-top-level": "off",
"@dimensiondev/no-unsafe-date": "error",
"@dimensiondev/prefer-default-export": "off",
"@dimensiondev/prefer-early-return": "error",
"@dimensiondev/prefer-fetch": "error",
"@dimensiondev/prefer-timer-id": "error"
}
}
Key: :white_check_mark: = recommended, :wrench: = fixable, :bulb: = suggestions, :gear: = configurable, :thought_balloon: = requires type information
-
array/no-implicit-sort β
π
EnforceArray#sort
provide comparator function -
array/no-unneeded-flat-map β
π§
DisallowArray#flatMap((x) => x)
when simpler alternatives exist -
array/prefer-from β
π§
Prefernew Array(...)
overArray.from(...)
-
browser/no-persistent-storage β
Disallow use browser persistent storage -
browser/no-set-html β
Disallow useElement#{inner,outer}HTML
-
browser/prefer-dataset β
π§ π
PreferElement#dataset
overElement#{get,set,has,remove}Attribute
-
browser/prefer-event-target β
π§ π
PreferEventTarget#{add,remove}EventListener()
overon
-functions -
browser/prefer-keyboard-event-key β
π§ π
PreferKeyboardEvent#key
overKeyboardEvent#{keyCode,charCode,which}
-
browser/prefer-location-assign β
π§
Preferlocation.assign(...)
overlocation.*
-
browser/prefer-modern-dom-apis β
π§ π
Prefer Modern DOM APIs -
browser/prefer-query-selector β
π§ π
PreferElement#querySelector
overElement#getElementById
-
browser/prefer-text-content β
π‘ π
PreferElement#textContent
overElement#innerText
-
jsx/no-class-component β
Disallow React Class Component -
jsx/no-logical βοΈ
Limit the complexity of JSX logic expression -
jsx/no-set-html β
Disallow usedangerouslySetInnerHTML
jsx attribute -
jsx/no-template-literal β
π§
Disallow use template-literal in JSX -
jsx/no-unneeded-nested β
π§
Reduce unneeded JSXFragment nested -
jsx/prefer-test-id βοΈ
Enforcesdata-test-id
attribute is present on interactive DOM elements to help with UI testing -
string/no-data-url β
Disallow use Data URL -
string/no-interpolation β
Disallow simple string interpolation -
string/no-locale-case β
π§
Disallow useString#toLocale{Upper,Lower}Case()
-
string/no-simple-template-literal β
π§
Disallow simple template-literal -
string/no-unneeded-to-string β
π§ π
DisallowString#toString()
when simpler alternatives exist -
type/no-bigint π
Disallow use BigInt -
type/no-const-enum π§
Disallow use constants enumerate -
type/no-empty-literal βοΈ
Disallow empty {array,object} literal -
type/no-force-cast-via-top-type β
Disallowing cast a typeT
to unrelated or incompatible typeQ
viaT as any as Q
-
type/no-instanceof-wrapper β
π§
Disallowinstanceof
for wrapper objects -
type/no-number-constructor β
Disallow useNumber
constructor -
type/no-wrapper-type-reference β
π§
Disallow wrapper type for type reference -
type/prefer-return-type-annotation β
π§
Enforce Move return type annotation to function return type -
unicode/no-bidi π§
Detect and stop Trojan Source attacks -
unicode/no-invisible β
π§
Disallow invisible characters -
unicode/specific-set π§ βοΈ
Limit the range of literal characters -
ban-eslint-disable β
βοΈ
Baneslint-disable
comment directive -
no-builtin-base64 β
π§
Disallow use built-in base64 function -
no-default-error β
π
Restrict the usage of default (unextended) error -
no-redundant-variable β
π§
Disallow redundant variable -
no-single-return β
Disallow single-return -
no-then β
DisallowPromise#then(...)
-
no-timer
Disallow use timer function -
no-top-level βοΈ
Disallow side-effect at module top-level -
no-unsafe-date β
π
Disallow use unsafe Date methods -
prefer-default-export βοΈ
Enforce default export location at top or bottom -
prefer-early-return β
π§ βοΈ
Prefer early returns over full-body conditional wrapping in function declarations -
prefer-fetch β
Enforce fetch -
prefer-timer-id β
π‘
Enforce best practice with timer function
Details
- eslint-plugin
- DimensionDev
- over 2 years ago
- MIT
- 26 dependencies
Assets
- eslint-plugin-0.0.2-20220512055634-f396a48-npm.tgz
Download activity
- Total downloads 1
- Last 30 days 0
- Last week 0
- Today 0