Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-sort-class-members

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-class-members - npm Package Compare versions

Comparing version 1.10.0 to 1.11.0

3

dist/rules/schema.js

@@ -27,2 +27,5 @@ "use strict";

"enum": ['getThenSet', 'setThenGet', 'together', 'any']
},
locale: {
type: 'string'
}

@@ -29,0 +32,0 @@ },

12

dist/rules/sort-class-members.js

@@ -52,2 +52,3 @@ "use strict";

var groupAccessors = accessorPairPositioning !== 'any';
var locale = options.locale || 'en-US';
var rules = {

@@ -94,3 +95,3 @@ ClassDeclaration: function ClassDeclaration(node) {

var problems = findProblems(members);
var problems = findProblems(members, locale);
var problemCount = problems.length;

@@ -309,6 +310,7 @@

function findProblems(members) {
function findProblems(members, locale) {
var problems = [];
var collator = new Intl.Collator(locale);
forEachPair(members, function (first, second) {
if (!areMembersInCorrectOrder(first, second)) {
if (!areMembersInCorrectOrder(first, second, collator)) {
problems.push({

@@ -332,6 +334,6 @@ source: second,

function areMembersInCorrectOrder(first, second) {
function areMembersInCorrectOrder(first, second, collator) {
return first.acceptableSlots.some(function (a) {
return second.acceptableSlots.some(function (b) {
return a.index === b.index && areSlotsAlphabeticallySorted(a, b) ? first.name.localeCompare(second.name) <= 0 : a.index <= b.index;
return a.index === b.index && areSlotsAlphabeticallySorted(a, b) ? collator.compare(first.name, second.name) <= 0 : a.index <= b.index;
});

@@ -338,0 +340,0 @@ });

{
"name": "eslint-plugin-sort-class-members",
"version": "1.10.0",
"version": "1.11.0",
"description": "ESLint rule for enforcing consistent ES6 class member order.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -82,2 +82,3 @@ [![build][ci-image]][ci-url]

- `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 is `false`.
- `locale`: Used to specify the locale for the name comparison method. The default is `en-US`.

@@ -84,0 +85,0 @@ ```js

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc