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
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
}
],
...
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
.