Closed pahan35 closed 4 years ago
Relates to #3
eslint-plugin-sort-keys-fix: 1.1.0 Node.js: 13.7.0
npm i -D babel-eslint eslint eslint-plugin-sort-keys-fix
.eslintrc
{ "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 8, "sourceType": "module", }, "plugins": [ "sort-keys-fix" ], "env": { "browser": true, "es6": true, }, "rules": { "sort-keys-fix/sort-keys-fix": "error" } }
var z = {} var obj = {b:1, ...z, a:1}
No violations
ESLint: Expected object keys to be in ascending order. 'a' should be before 'b'.(sort-keys-fix/sort-keys-fix)
It's problematic in cases where we want to allow overriding some in the target object
function foo(overridings) { const target = {b: 7, ...overridings, a: 5} }
Also, current behavior causes bugs like described in https://github.com/leo-buneev/eslint-plugin-sort-keys-fix/issues/2#issuecomment-615877695
Thx @pahan35 . Released in 1.1.1.
Relates to #3
Versions
eslint-plugin-sort-keys-fix: 1.1.0 Node.js: 13.7.0
Dependencies
npm i -D babel-eslint eslint eslint-plugin-sort-keys-fix
.eslintrc
Code to reproduce
Expected
No violations
Actual
Motivation
It's problematic in cases where we want to allow overriding some in the target object
Also, current behavior causes bugs like described in https://github.com/leo-buneev/eslint-plugin-sort-keys-fix/issues/2#issuecomment-615877695