eslint-plugin-sort-exports icon indicating copy to clipboard operation
eslint-plugin-sort-exports copied to clipboard

Selectively enable export member sort

Open DarioSoller opened this issue 1 year ago • 0 comments

It would be cool to have an option to selectively only enable export member sorting, without export declarations being sorted as well.

Similar to the sort-import setting:

		"sort-imports": [
			"error",
			{
				"ignoreCase": true,
				"ignoreDeclarationSort": true,
				"ignoreMemberSort": false
			}
		],

so that only export {b, a, c} from 'foo' will be sorted to export {a, b, c} from 'foo'.

Why Imagine having some declarative single const exports:

export const b = 'someValue';
export const a = b + 'Addition';

being sorted to:

export const a = b + 'Addition';
export const b = 'someValue';

this will cause an ReferenceError: Cannot access 'b' before initialization Error.

DarioSoller avatar Aug 11 '23 06:08 DarioSoller