eslint-plugin-sort-keys-custom-order's People
Forkers
tukusejssirseslint-plugin-sort-keys-custom-order's Issues
Sorting a large object or type takes too many rounds
I tried to sort a large interface (34 properties), as well as an object created from it, however, your plugin didn’t sort it in one run (running once eslint_d --fix $file
), however, it took five rounds.
When I tried to do the same with an object with the same structure, it took six rounds!
Moreover, it does not append a comma. I don’t use trailing commas (never), however, when your plugins sort the properties, it leave the property which was originally the last one, without comma and the property which is currently the last one, with comma.
interface
interface: orig
export interface I {
PSQL_ADMIN_PASS: string,
PSQL_ADMIN_USER: string,
PSQL_DB_NAME_CS: string,
PSQL_HOST: string,
PSQL_PORT: number,
PSQL_MAX_CONN: number,
CACHE_PORT: number,
CERT_CA: string,
CERT_CERT: string,
CERT_KEY: string,
LIGHT_INDICATOR_TCP_PORT: number,
LOG_LEVEL: string,
LOG_LEVEL_ORM: boolean | undefined,
MODBUS_PORT: number,
MODBUS_TCP_PORT: number,
MONGO_DATABASE_FANUC: string,
MONGO_DATABASE_WS: string,
MONGO_HOST: string
MONGO_PASS: string,
MONGO_PORT: number,
MONGO_USER: string,
MACHINE_TCP_PORT: number,
MQTT_MQTT_HOST: string,
MQTT_MQTT_PORT: number,
MQTT_MQTT_PROTOCOL: string,
MQTT_TCP_PORT: number,
MQTT_WS_HOST: string,
MQTT_WS_PORT: number,
MQTT_WS_PROTOCOL: string,
NEST_PORT: number,
POWER_ON_PORT: number,
REDIS_HOST: string,
REDIS_PORT: number,
TIMEZONE: string,
}
interface: after first run
export interface I {
CACHE_PORT: number,
CERT_CA: string,
CERT_CERT: string,
CERT_KEY: string,
PSQL_ADMIN_PASS: string,
LIGHT_INDICATOR_TCP_PORT: number,
PSQL_ADMIN_USER: string,
LOG_LEVEL: string,
PSQL_DB_NAME_CS: string,
LOG_LEVEL_ORM: boolean | undefined,
PSQL_HOST: string,
MACHINE_TCP_PORT: number,
PSQL_MAX_CONN: number,
MODBUS_PORT: number,
PSQL_PORT: number,
MODBUS_TCP_PORT: number,
MONGO_DATABASE_FANUC: string,
MONGO_DATABASE_WS: string
MONGO_HOST: string,
MONGO_PASS: string,
MONGO_PORT: number,
MONGO_USER: string,
MQTT_MQTT_HOST: string,
MQTT_MQTT_PORT: number,
MQTT_MQTT_PROTOCOL: string,
MQTT_TCP_PORT: number,
MQTT_WS_HOST: string,
MQTT_WS_PORT: number,
MQTT_WS_PROTOCOL: string,
NEST_PORT: number,
POWER_ON_PORT: number,
REDIS_HOST: string,
REDIS_PORT: number,
TIMEZONE: string,
}
interface: after second run
export interface I {
CACHE_PORT: number,
CERT_CA: string,
CERT_CERT: string,
CERT_KEY: string,
LIGHT_INDICATOR_TCP_PORT: number,
LOG_LEVEL: string,
LOG_LEVEL_ORM: boolean | undefined,
MACHINE_TCP_PORT: number,
MODBUS_PORT: number,
MODBUS_TCP_PORT: number,
MONGO_DATABASE_FANUC: string,
MONGO_DATABASE_WS: string,
MONGO_HOST: string,
MONGO_PASS: string,
PSQL_ADMIN_PASS: string,
MONGO_PORT: number,
PSQL_ADMIN_USER: string,
MONGO_USER: string
PSQL_DB_NAME_CS: string,
MQTT_MQTT_HOST: string,
PSQL_HOST: string,
MQTT_MQTT_PORT: number,
PSQL_MAX_CONN: number,
MQTT_MQTT_PROTOCOL: string,
PSQL_PORT: number,
MQTT_TCP_PORT: number,
MQTT_WS_HOST: string,
MQTT_WS_PORT: number,
MQTT_WS_PROTOCOL: string,
NEST_PORT: number,
POWER_ON_PORT: number,
REDIS_HOST: string,
REDIS_PORT: number,
TIMEZONE: string,
}
interface: after third run
export interface I {
CACHE_PORT: number,
CERT_CA: string,
CERT_CERT: string,
CERT_KEY: string,
LIGHT_INDICATOR_TCP_PORT: number,
LOG_LEVEL: string,
LOG_LEVEL_ORM: boolean | undefined,
MACHINE_TCP_PORT: number,
MODBUS_PORT: number,
MODBUS_TCP_PORT: number,
MONGO_DATABASE_FANUC: string,
MONGO_DATABASE_WS: string,
MONGO_HOST: string,
MONGO_PASS: string,
MONGO_PORT: number,
MONGO_USER: string,
MQTT_MQTT_HOST: string,
MQTT_MQTT_PORT: number
MQTT_MQTT_PROTOCOL: string,
MQTT_TCP_PORT: number,
MQTT_WS_HOST: string,
MQTT_WS_PORT: number,
MQTT_WS_PROTOCOL: string,
NEST_PORT: number,
PSQL_ADMIN_PASS: string,
POWER_ON_PORT: number,
PSQL_ADMIN_USER: string,
PSQL_DB_NAME_CS: string,
PSQL_HOST: string,
PSQL_MAX_CONN: number,
PSQL_PORT: number,
REDIS_HOST: string,
REDIS_PORT: number,
TIMEZONE: string,
}
interface: after fourth run
export interface I {
CACHE_PORT: number,
CERT_CA: string,
CERT_CERT: string,
CERT_KEY: string,
LIGHT_INDICATOR_TCP_PORT: number,
LOG_LEVEL: string,
LOG_LEVEL_ORM: boolean | undefined,
MACHINE_TCP_PORT: number,
MODBUS_PORT: number,
MODBUS_TCP_PORT: number,
MONGO_DATABASE_FANUC: string,
MONGO_DATABASE_WS: string,
MONGO_HOST: string,
MONGO_PASS: string,
MONGO_PORT: number,
MONGO_USER: string,
MQTT_MQTT_HOST: string,
MQTT_MQTT_PORT: number
MQTT_MQTT_PROTOCOL: string,
MQTT_TCP_PORT: number,
MQTT_WS_HOST: string,
MQTT_WS_PORT: number,
MQTT_WS_PROTOCOL: string,
NEST_PORT: number,
POWER_ON_PORT: number,
PSQL_ADMIN_PASS: string,
PSQL_ADMIN_USER: string,
PSQL_DB_NAME_CS: string,
PSQL_HOST: string,
PSQL_MAX_CONN: number,
PSQL_PORT: number,
REDIS_HOST: string,
REDIS_PORT: number,
TIMEZONE: string,
}
object
object: orig
const a = {
PSQL_ADMIN_PASS: '',
PSQL_ADMIN_USER: '',
PSQL_DB_NAME_CS: '',
PSQL_HOST: '',
PSQL_PORT: 1,
PSQL_MAX_CONN: 1,
CACHE_PORT: 1,
CERT_CA: '',
CERT_CERT: '',
CERT_KEY: '',
LIGHT_INDICATOR_TCP_PORT: 1,
LOG_LEVEL: '',
LOG_LEVEL_ORM: true,
MODBUS_PORT: 1,
MODBUS_TCP_PORT: 1,
MONGO_DATABASE_FANUC: '',
MONGO_DATABASE_WS: '',
MONGO_HOST: '',
MONGO_PASS: '',
MONGO_PORT: 1,
MONGO_USER: '',
MACHINE_TCP_PORT: 1,
MQTT_MQTT_HOST: '',
MQTT_MQTT_PORT: 1,
MQTT_MQTT_PROTOCOL: '',
MQTT_TCP_PORT: 1,
MQTT_WS_HOST: '',
MQTT_WS_PORT: 1,
MQTT_WS_PROTOCOL: '',
NEST_PORT: 1,
POWER_ON_PORT: 1,
REDIS_HOST: '',
REDIS_PORT: 1,
TIMEZONE: '',
}
object: after first run
const a = {
CACHE_PORT: 1,
CERT_CA: '',
PSQL_ADMIN_PASS: '',
CERT_CERT: '',
PSQL_ADMIN_USER: '',
PSQL_DB_NAME_CS: '',
CERT_KEY: '',
PSQL_HOST: '',
PSQL_MAX_CONN: 1,
LIGHT_INDICATOR_TCP_PORT: 1,
PSQL_PORT: 1,
LOG_LEVEL: '',
LOG_LEVEL_ORM: true,
MACHINE_TCP_PORT: 1,
MODBUS_PORT: 1,
MODBUS_TCP_PORT: 1,
MONGO_DATABASE_FANUC: '',
MONGO_DATABASE_WS: '',
MONGO_HOST: '',
MONGO_PASS: '',
MONGO_PORT: 1,
MONGO_USER: '',
MQTT_MQTT_HOST: '',
MQTT_MQTT_PORT: 1,
MQTT_MQTT_PROTOCOL: '',
MQTT_TCP_PORT: 1,
MQTT_WS_HOST: '',
MQTT_WS_PORT: 1,
MQTT_WS_PROTOCOL: '',
NEST_PORT: 1,
POWER_ON_PORT: 1,
REDIS_HOST: '',
REDIS_PORT: 1,
TIMEZONE: ''
}
object: after second run
const a = {
CACHE_PORT: 1,
CERT_CA: '',
CERT_CERT: '',
CERT_KEY: '',
LIGHT_INDICATOR_TCP_PORT: 1,
LOG_LEVEL: '',
LOG_LEVEL_ORM: true,
PSQL_ADMIN_PASS: '',
MACHINE_TCP_PORT: 1,
PSQL_ADMIN_USER: '',
PSQL_DB_NAME_CS: '',
MODBUS_PORT: 1,
PSQL_HOST: '',
PSQL_MAX_CONN: 1,
MODBUS_TCP_PORT: 1,
PSQL_PORT: 1,
MONGO_DATABASE_FANUC: '',
MONGO_DATABASE_WS: '',
MONGO_HOST: '',
MONGO_PASS: '',
MONGO_PORT: 1,
MONGO_USER: '',
MQTT_MQTT_HOST: '',
MQTT_MQTT_PORT: 1,
MQTT_MQTT_PROTOCOL: '',
MQTT_TCP_PORT: 1,
MQTT_WS_HOST: '',
MQTT_WS_PORT: 1,
MQTT_WS_PROTOCOL: '',
NEST_PORT: 1,
POWER_ON_PORT: 1,
REDIS_HOST: '',
REDIS_PORT: 1,
TIMEZONE: ''
}
object: after third run
const a = {
CACHE_PORT: 1,
CERT_CA: '',
CERT_CERT: '',
CERT_KEY: '',
LIGHT_INDICATOR_TCP_PORT: 1,
LOG_LEVEL: '',
LOG_LEVEL_ORM: true,
MACHINE_TCP_PORT: 1,
MODBUS_PORT: 1,
MODBUS_TCP_PORT: 1,
MONGO_DATABASE_FANUC: '',
MONGO_DATABASE_WS: '',
PSQL_ADMIN_PASS: '',
MONGO_HOST: '',
PSQL_ADMIN_USER: '',
PSQL_DB_NAME_CS: '',
MONGO_PASS: '',
PSQL_HOST: '',
PSQL_MAX_CONN: 1,
MONGO_PORT: 1,
PSQL_PORT: 1,
MONGO_USER: '',
MQTT_MQTT_HOST: '',
MQTT_MQTT_PORT: 1,
MQTT_MQTT_PROTOCOL: '',
MQTT_TCP_PORT: 1,
MQTT_WS_HOST: '',
MQTT_WS_PORT: 1,
MQTT_WS_PROTOCOL: '',
NEST_PORT: 1,
POWER_ON_PORT: 1,
REDIS_HOST: '',
REDIS_PORT: 1,
TIMEZONE: ''
}
object: after fourth run
const a = {
CACHE_PORT: 1,
CERT_CA: '',
CERT_CERT: '',
CERT_KEY: '',
LIGHT_INDICATOR_TCP_PORT: 1,
LOG_LEVEL: '',
LOG_LEVEL_ORM: true,
MACHINE_TCP_PORT: 1,
MODBUS_PORT: 1,
MODBUS_TCP_PORT: 1,
MONGO_DATABASE_FANUC: '',
MONGO_DATABASE_WS: '',
MONGO_HOST: '',
MONGO_PASS: '',
MONGO_PORT: 1,
MONGO_USER: '',
MQTT_MQTT_HOST: '',
PSQL_ADMIN_PASS: '',
MQTT_MQTT_PORT: 1,
PSQL_ADMIN_USER: '',
PSQL_DB_NAME_CS: '',
MQTT_MQTT_PROTOCOL: '',
PSQL_HOST: '',
PSQL_MAX_CONN: 1,
MQTT_TCP_PORT: 1,
PSQL_PORT: 1,
MQTT_WS_HOST: '',
MQTT_WS_PORT: 1,
MQTT_WS_PROTOCOL: '',
NEST_PORT: 1,
POWER_ON_PORT: 1,
REDIS_HOST: '',
REDIS_PORT: 1,
TIMEZONE: ''
}
object: after fifth run
const a = {
CACHE_PORT: 1,
CERT_CA: '',
CERT_CERT: '',
CERT_KEY: '',
LIGHT_INDICATOR_TCP_PORT: 1,
LOG_LEVEL: '',
LOG_LEVEL_ORM: true,
MACHINE_TCP_PORT: 1,
MODBUS_PORT: 1,
MODBUS_TCP_PORT: 1,
MONGO_DATABASE_FANUC: '',
MONGO_DATABASE_WS: '',
MONGO_HOST: '',
MONGO_PASS: '',
MONGO_PORT: 1,
MONGO_USER: '',
MQTT_MQTT_HOST: '',
MQTT_MQTT_PORT: 1,
MQTT_MQTT_PROTOCOL: '',
MQTT_TCP_PORT: 1,
MQTT_WS_HOST: '',
MQTT_WS_PORT: 1,
PSQL_ADMIN_PASS: '',
MQTT_WS_PROTOCOL: '',
PSQL_ADMIN_USER: '',
PSQL_DB_NAME_CS: '',
NEST_PORT: 1,
PSQL_HOST: '',
PSQL_MAX_CONN: 1,
POWER_ON_PORT: 1,
PSQL_PORT: 1,
REDIS_HOST: '',
REDIS_PORT: 1,
TIMEZONE: ''
}
Add flat config support (ESlint 9.0.0)
Requires this typescript-eslint update:
Specifically, RuleTester seems not compatible with flat config for now.
Serialized Error: { messageTemplate: 'eslintrc-incompat', messageData: { key: 'parser' } }
Caused by: Error: This appears to be in eslintrc format rather than flat config format.
TS: When using comma in properties separation, their order is fixed incorrectly
Example
// NOT WORKING
// Original
function a(): Promise<{b: string, a: string}> {}
const a: {b: string, a: string} = {b: 'c', a: 'd'}
// Auto-fixed
function a(): Promise<{a: string b: string,}> {}
const a: {a: string b: string,} = {a: 'd', b: 'c'}
// Expected output
function a(): Promise<{a: string, b: string}> {}
const a: {a: string, b: string} = {a: 'd', b: 'c'}
---
// WORKING
// Original
function a(): Promise<{
b: string,
a: string
}> {}
// Auto-fixed
function a(): Promise<{
a: string,
b: string
}> {}
Thank you for this awesome plugin! Could you fix the issue above please? It is related to types only, not the object values.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.