eslint-plugin-sort-keys
Advanced tools
Comparing version 2.3.4 to 2.3.5
@@ -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 @@ } |
{ | ||
"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 @@ // |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47905
1353
37