eslint-plugin-sequence

1.1.1 • Public • Published

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

(fixable): sort import statements by path

(fixable): sort imported members by name

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

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

(fixable): sort keys in object destructuring statements

Installation

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

Configure with EsLint, e.g. in eslint.config.mjs

import sequence from "eslint-plugin-sequence";

...

        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", {
                    ignoreImports: false,
                    ignoredIdentifiers: ["legacyAPI", "htmlToXML", "PI", "TAU", "EPSILON"],
                    allowOneCharWords: "last",
                    ignoreSingleWordsIn: ["enum_member", "static_class_field"]
                }
            ],
            "sequence/logical-expression-complexity": [
                "error", {
                    maxHeight: 3,
                    maxTerms: 6,
                    binaryOperators: ["==", "===", "!=", "!=="],
                    includeTernary: true
                }
            ],
            "sequence/ordererd-destructuring": [
                "error", {
                    ignoreCase: true,
                    natural: true
                }
            ],
...

Compatibility

As of version 1.0.0, the plugin requires eslint peer 9.x. To use with older versions of eslint, use version 0.7.0.

Package Sidebar

Install

npm i eslint-plugin-sequence

Weekly Downloads

3

Version

1.1.1

License

ISC

Unpacked Size

112 kB

Total Files

21

Last publish

Collaborators

  • adashrod