eslint-plugin-sort-class-members weekly downloads statistics
By bryanrsmith (2 listings) · npm · ESLint plugins
ESLint rule for enforcing consistent ES6 class member order.
eslint-plugin-sort-class-members has 820,998 recorded weekly downloads on npm, an increase of 24.1% over the past 30 days, ranking #315 of 3,247 tracked listings.
About eslint-plugin-sort-class-members
[![build][ci-image]][ci-url] [![npm][npm-image]][npm-url]
eslint-plugin-sort-class-members
ESLint rule for enforcing consistent ES6 class member order.
Installation
Install ESLint and eslint-plugin-sort-class-members:
$ npm install eslint eslint-plugin-sort-class-members --save-dev
Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-sort-class-members globally.
Usage
Add sort-class-members to the plugins section of your .eslintrc configuration file, and configure the rule under the rules section.
{
"plugins": ["sort-class-members"],
"rules": {
"sort-class-members/sort-class-members": [
2,
{
"order": [
"[static-properties]",
"[static-methods]",
"[properties]",
"[conventional-private-properties]",
"constructor",
"[methods]",
"[conventional-private-methods]"
],
"accessorPairPositioning": "getThenSet"
}
]
}
}
Or, using ESLint's Flat Config (eslint.config.js):
import sortClassMembers from "eslint-plugin-sort-class-members";
export default [
// Use the default configuration shown above.
sortClassMembers.configs["flat/recommended"],
rules: {
// Customize specific configuration properties
"sort-class-members/sort-class-members": [
2,
{
"accessorPairPositioning": "together",
"stopAfterFirstProblem": true
}
]
}
];
When using the default configuration (shown above), the following patterns are considered problems:
class Foo {
b = 'bar';
c() {}
constructor() {} // error Expected constructor to come before method c
static a() {} // error Expected static method a to come before property b
}
When using the default configuration (shown above), the following patterns are not considered problems:
class Foo {
static a() {}
b = 'bar';
constructor() {}
c() {}
}
Configuration
The rule accepts the following configuration properties:
order: Used to specify the expected sort order of class members.groups: May optionally be used to created customized named groups of members so thatordercan be more easily maintained. Groups can be referenced by name by using square brackets. E.g.,"[group-name]".accessorPairPositioning: Used to specify the required positioning of get/set pairs. Available values:getThenSet,setThenGet,together,any.stopAfterFirstProblem: Only report the first sort problem in each class (plus the number of problems found). Useful if you only want to know that the class has sort problems without spamming error messages. The default isfalse.locale: Used to specify the locale for the name comparison method. The default isen-US.sortInterfaces: Used to specify whether to sort TypeScript interfaces as well. The default isfalse.
{
"order": [
"constructor",
"[event-handlers]", // reference the custom group defined in the "groups" property
"[everything-else]" // a few groups are provided by default (see list below)
],
"groups": {
"event-handlers": [{ "name": "/on.+/", "type": "method" }]
},
"accessorPairPositioning": "getThenSet",
"stopAfterFirstProblem": false
}
Members can be matched to positional slots using several criteria, including name (exact match or regexp), member type (method or property), and whether or not the member is static. Each match slot is described by an object with six properties, all of which are optional.…
Description from the npm listing.
- eslint
- eslintplugin
- eslint-plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (170)Similar npm ESLint plugins plugins
All 20 eslint-plugin-sort-class-members alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/eslint-plugin-sort-class-members. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.