eslint-plugin-sequence

A collection of EsLint rules variously related to sequences: import sorting, ordering, etc

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
eslint-plugin-sequence
000.5.76 months ago2 years agoMinified + gzip package size for eslint-plugin-sequence in KB

Readme

eslint-plugin-sequence
github actions npm npm downloads
A collection of EsLint rules variously related to sequences: sequences of imports, import members, characters, and other elements.
Import rules can be used on ES6+ imports, as well as TypeScript imports

ordered-imports-by-path

(fixable): sort import statements by path

ordered-import-members

(fixable): sort imported members by name

strict-camel-case

(fixable via suggestions): enforce StrictCamelCase style, forbid LOOSECamelCase

logical-expression-complexity

(not fixable): enforce limits on complexity of logical expressions

Installation

npm install --save-dev eslint-plugin-sequence

Configure with EsLint, e.g. in .eslintrc.json
...
"plugins": [
    "sequence"
],
"rules": {
    "sequence/ordered-imports-by-path": [
        "error", {
            "ignoreCase": true,
            "sortSideEffectsFirst": true,
            "allowSeparateGroups": true,
            "sortTypeImportsFirst": true
        }
    ],
    "sequence/ordered-import-members": [
        "error", {
            "ignoreCase": true,
            "sortSpecifiersWithComments": true
        }
    ],
    "sequence/strict-camel-case": [
        "error", {
            "ignoreProperties": false,
            "ignoreImports": false,
            "ignoredIdentifiers": ["legacyAPI", "htmlToXML", "PI", "TAU", "EPSILON"],
            "allowOneCharWords": "last",
            "ignoreSingleWords": false,
            "ignoreSingleWordsIn": ["enum_member", "static_class_field"]
        }
    ],
    "sequence/logical-expression-complexity": [
        "error", {
            "maxHeight": 3,
            "maxTerms": 6,
            "binaryOperators": ["==", "===", "!=", "!=="],
            "includeTernary": true
        }
    ],
    ...
}
...