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

eslint-plugin-sort-keys

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-sort-keys - npm Package Compare versions

Comparing version 2.3.4 to 2.3.5

37

__tests__/rules/sort-keys-fix.js

@@ -1047,2 +1047,30 @@ const { RuleTester } = require('eslint')

{
code: 'var obj = {\n a:1,\n b:3, // comment\n _:2\n}',
errors: [
"Expected object keys to be in ascending order. '_' should be before 'b'.",
],
output: 'var obj = {\n _:2,\n a:1,\n b:3 // comment\n}',
},
{
code: 'var obj = {\n a:1,\n b:2, // comment\n _:3,\n}',
errors: [
"Expected object keys to be in ascending order. '_' should be before 'b'.",
],
output: 'var obj = {\n _:3,\n a:1,\n b:2, // comment\n}',
},
{
code: 'var obj = {\n a:1,\n b:3,\n _:2 // comment\n}',
errors: [
"Expected object keys to be in ascending order. '_' should be before 'b'.",
],
output: 'var obj = {\n _:2, // comment\n a:1,\n b:3\n}',
},
{
code: 'var obj = {\n a:1,\n b:3,\n _:2 // comment\n,}',
errors: [
"Expected object keys to be in ascending order. '_' should be before 'b'.",
],
output: 'var obj = {\n _:2, // comment\n a:1,\n b:3\n,}',
},
{
code: 'var obj = {\n // comment\n // comment 2\n a:1,\n _:2,\n b:3\n}',

@@ -1063,2 +1091,11 @@ errors: [

},
// TODO
{
code: 'var obj = {/* comment\n comment 2 */ // comment 3\n a:1,\n _:2,\n b:3\n}',
errors: [
"Expected object keys to be in ascending order. '_' should be before 'a'.",
],
output:
'var obj = {/* comment\n comment 2 */ // comment 3\n _:2,\n a:1,\n b:3\n}',
},
],

@@ -1065,0 +1102,0 @@ }

2

package.json
{
"name": "eslint-plugin-sort-keys",
"version": "2.3.4",
"version": "2.3.5",
"description": "Fork of eslint rule that sorts keys in objects (https://eslint.org/docs/rules/sort-keys) with autofix enabled",

@@ -5,0 +5,0 @@ "repository": {

@@ -21,5 +21,12 @@ ### eslint-plugin-sort-keys

### Change log
### TODO
- 2.3.4: fix bug move comments incorrectly on the same line with property
- [ ] Add support for key groups
- [ ] Add css property key groups
- [ ] Fix failed test cases
### CHANGE LOG
- 2.3.5: fix bug move comments incorrectly
- 2.3.4: fix bug move comments incorrectly on the same line with the property
- 2.3.3: fix bug move comments incorrectly on top of a multi-line property

@@ -26,0 +33,0 @@ - 2.3.2: some typos and improvements, add change log

@@ -189,10 +189,2 @@ const naturalCompare = require('natural-compare')

fixes.push(fixer.insertTextAfter(toPrev, txt))
// In case the last comment overwrite the next token, add new line
const after = toNode
if (
toPrev.loc.end.line === after.loc.start.line &&
commentsBefore[commentsBefore.length - 1].type === 'Line'
) {
fixes.push(fixer.insertTextBefore(after, '\n'))
}
}

@@ -211,10 +203,2 @@ // Move comments on the same line with this property

fixes.push(fixer.insertTextAfter(toNext, txt))
// In case the last comment overwrite the next token, add new line
const after = src.getTokenAfter(toNext, { includeComments: true })
if (
toNext.loc.end.line === after.loc.start.line &&
commentsAfter[commentsAfter.length - 1].type === 'Line'
) {
fixes.push(fixer.insertTextBefore(after, '\n'))
}
}

@@ -221,0 +205,0 @@ //

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