Giter Site home page Giter Site logo

infctr / eslint-plugin-typescript-sort-keys Goto Github PK

View Code? Open in Web Editor NEW
143.0 143.0 27.0 716 KB

A linter plugin to require sorting interface and string enum keys

License: ISC License

JavaScript 2.91% TypeScript 97.09%
eslint eslint-plugin typescript

eslint-plugin-typescript-sort-keys's Introduction

Tests

eslint-plugin-typescript-sort-keys

Sort interface and string enum keys

Inspired by and sourced from eslint/sort-keys

Installation

You'll first need to install

yarn add -D eslint typescript @typescript-eslint/parser

Next, install eslint-plugin-typescript-sort-keys:

yarn add -D eslint-plugin-typescript-sort-keys

Note: If you installed ESLint globally then you must also install eslint-plugin-typescript-sort-keys globally.

Usage

Specify the parser for typescript files in your .eslintrc configuration file:

{
  "parser": "@typescript-eslint/parser"
}

Add typescript-sort-keys to the plugins section. You can omit the eslint-plugin- prefix:

{
  "plugins": ["typescript-sort-keys"]
}

Then configure the rules you want to use under the rules section.

{
  "rules": {
    "typescript-sort-keys/interface": "error",
    "typescript-sort-keys/string-enum": "error"
  }
}

Or enable all rules with defaults

{
  "extends": ["plugin:typescript-sort-keys/recommended"]
}

Supported Rules

Key: โœ”๏ธ = recommended, ๐Ÿ”ง = fixable

Name Description โœ”๏ธ ๐Ÿ”ง
typescript-sort-keys/interface require interface keys to be sorted โœ”๏ธ ๐Ÿ”ง
typescript-sort-keys/string-enum require string enum members to be sorted โœ”๏ธ ๐Ÿ”ง

eslint-plugin-typescript-sort-keys's People

Contributors

amritk avatar dependabot[bot] avatar entropitor avatar infctr avatar ivangabriele avatar johnmartel avatar k1rd3rf avatar kai-dorschner-twinsity avatar nhannah avatar noelebrun avatar szamanr avatar thdk avatar worldlee78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

eslint-plugin-typescript-sort-keys's Issues

Consider sorting other types of enums?

I'm finalizing my branch before PR for #26 and I noticed the linter works just fine on other kinds of enums. For example, the test case enum U {c=1<<1, b, a} has no special work required to sort. Is there a specific reason to only sort string enums? If not, I'd propose changing the rule to just enum instead of string-enum.

I figured something such as changing rule names should be part of a major version change, might as well lump it in with the same PR

Publish new version with @typescript-eslint/parser@6

Publish please new version of plugin with peerDependencies "@typescript-eslint/parser": "^6".
I was created my own eslint rules pack with eslint-plugin-typescript-sort-keys, but when install the pack - @typescript-eslint/parser v5 conflict with v6 wrom other packages and npm install put it in to nested (not root) node_modules and cant find it, when start eslint.

string-enum ignores comments

I noticed that string-enum rule ignores comments, so if you have comments on the right like

enum Events {
  MyEvent2 = 'My Event 2' // my event 2
  MyEvent1 = 'My Event 1' // my event 1

will become

enum Events {
  MyEvent1 = 'My Event 1' // my event 2
  MyEvent2 = 'My Event 2' // my event 1

which is wrong

Do you want to accept a PR for it?

Does not Sort in One Go

In very large and nested type definitions, Iโ€™ve noticed that this plugin needs up to 5 runs in order to fix all reported sorting issues. First time it finds ~3000, then ~500, then ~50, then 1, then 0.

This wouldnโ€™t be a big deal for manually written code as it rarely changes in significant ways. The file in question is an auto-generated typescript definition file for an entire OpenAPI specification though

Support ESLint 8.x

ESLint v8.0.0 is released ๐ŸŽ‰

It would be awesome to have official ESLint 8 support. ๐Ÿ‘Š
I'm happy to help where I can of course ๐Ÿ™‚

Type aliases

What are your thoughts on a lint rule that enforces key sorting for type aliases? E.g.

type Foo = {
  b: string;
  a: string;
}

Incompatible with eslint-config-airbnb-typescript 17.1.0

When eslint-config-airbnb-typescript 17.1.0 is installed, you cannot install 3.0.0.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^5.0.0" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     peer @typescript-eslint/eslint-plugin@"^5.13.0 || ^6.0.0" from [email protected]
npm ERR!     node_modules/eslint-config-airbnb-typescript
npm ERR!       dev eslint-config-airbnb-typescript@"17.1.0" from the root project
npm ERR!     peerOptional @typescript-eslint/eslint-plugin@"^5.0.0 || ^6.0.0" from [email protected]
npm ERR!     node_modules/eslint-plugin-jest
npm ERR!       dev eslint-plugin-jest@"27.2.3" from the root project
npm ERR!   peer @typescript-eslint/parser@"^5.0.0 || ^6.0.0" from [email protected]
npm ERR!   node_modules/eslint-config-airbnb-typescript
npm ERR!     dev eslint-config-airbnb-typescript@"17.1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev eslint-plugin-typescript-sort-keys@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^6" from [email protected]
npm ERR!   node_modules/eslint-plugin-typescript-sort-keys
npm ERR!     dev eslint-plugin-typescript-sort-keys@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

When you try to install 2.3.0:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^5.0.0 || ^6.0.0" from [email protected]
npm ERR!   node_modules/eslint-config-airbnb-typescript
npm ERR!     dev eslint-config-airbnb-typescript@"17.1.0" from the root project
npm ERR!   peer @typescript-eslint/parser@"^6.0.0 || ^6.0.0-alpha" from @typescript-eslint/[email protected]
npm ERR!   node_modules/@typescript-eslint/eslint-plugin
npm ERR!     peer @typescript-eslint/eslint-plugin@"^5.13.0 || ^6.0.0" from [email protected]
npm ERR!     node_modules/eslint-config-airbnb-typescript
npm ERR!       dev eslint-config-airbnb-typescript@"17.1.0" from the root project
npm ERR!     peerOptional @typescript-eslint/eslint-plugin@"^5.0.0 || ^6.0.0" from [email protected]
npm ERR!     node_modules/eslint-plugin-jest
npm ERR!       dev eslint-plugin-jest@"27.2.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev eslint-plugin-typescript-sort-keys@"2.3.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   peer @typescript-eslint/parser@"^1 || ^2 || ^3 || ^4 || ^5" from [email protected]
npm ERR!   node_modules/eslint-plugin-typescript-sort-keys
npm ERR!     dev eslint-plugin-typescript-sort-keys@"2.3.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

2.3.0 works fine with eslint-config-airbnb-typescript 17.0.0.

Conflict to @typescript-eslint/member-ordering

I like this plugin idea which will auto-fix the member ordering inside interface

but seem it would conflict to
member-order

because this plugin don't care the member type

E.G. given below interface

interface Demo {
   b: string
   a() : void
}

it would complain error in above interface because a is after b.

But if fix it by move a before b, member-ordering would complain method should after attribute.

Beside turn off either one, did it any suggestion can keep both running ?

Outdated transient version of @typescript-eslint/typescript-estree

Ahoy there. This package has a dependency on @typescript-eslint/[email protected] which is super old. As such, the transient dependency on @typescript-eslint/[email protected] via @typescript-eslint/experimental-utils is causing the following message to print each time we use the plugin:

=============

WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: >=3.3.1 <4.2.0

YOUR TYPESCRIPT VERSION: 4.3.5

Please only submit bug reports when using the officially supported version.

=============

Please update that dependency to 4.28.3

Configuration for capital case

Hello! ๐Ÿ‘‹

Can I configure the "typescript-sort-keys/interface" rule so that it is not case sensitive? In my scenario it complains about the following:

interface Test {
  client: string;
  REST_URL: string;
}

Expected interface keys to be in ascending order. 'REST_URL' should be before 'client'

But in my case I want to prefer "client" to be on top because "c" comes before "r" (when not case sensitive).

ESLint couldn't find the plugin "eslint-plugin-typescript-sort-keys"

Since today.

Command:

npm run eslint --fix --ext .js,.ts --cache scripts/ src/ jest.config.js config.ts

The stack trace:

ESLint couldn't find the plugin "eslint-plugin-typescript-sort-keys".

(The package "eslint-plugin-typescript-sort-keys" was not found when loaded as a Node module from the directory "D:\cozen\Documents\sonia\il-est-midi-discord".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install eslint-plugin-typescript-sort-keys@latest --save-dev

The plugin "eslint-plugin-typescript-sort-keys" was referenced from the config file in ".eslintrc".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @sonia-corporation/[email protected] lint: `eslint --fix --ext .js,.ts --cache scripts/ src/ jest.config.js config.ts`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @sonia-corporation/[email protected] lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\cozen\AppData\Roaming\npm-cache\_logs\2020-05-22T15_27_39_621Z-debug.log

Process finished with exit code 2

Environments:

"@typescript-eslint/eslint-plugin": "3.0.0"
"@typescript-eslint/parser": "3.0.0"
"eslint": "7.1.0"
"eslint": "7.1.0"
"eslint-config-google": "0.14.0"
"eslint-config-prettier": "6.11.0"
"eslint-config-recommended": "4.0.0"
"eslint-plugin-import": "2.20.2"
"eslint-plugin-jest": "23.13.1"
"eslint-plugin-prettier": "3.1.3"
"eslint-plugin-rxjs": "0.0.2-beta.22"
"eslint-plugin-typescript-sort-keys": "1.0.2"

.eslintrc:

root: true
env:
  es6: true
  node: true
  jest/globals: true
extends:
  - 'eslint:recommended'
  - google
  - 'plugin:@typescript-eslint/eslint-recommended'
  - 'plugin:@typescript-eslint/recommended'
  - 'plugin:import/errors'
  - 'plugin:import/warnings'
  - 'plugin:import/typescript'
  - 'plugin:jest/style'
  - 'plugin:jest/all'
  - 'plugin:prettier/recommended'
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parserOptions:
  ecmaVersion: 2018
  sourceType: module
  project: ./tsconfig.json
parser: '@typescript-eslint/parser'
plugins:
  - '@typescript-eslint'
  - typescript-sort-keys
  - jest
  - prettier
settings:
  import/extensions:
    - .js
    - .ts
  import/parsers:
    '@typescript-eslint/parser':
      - .ts
  import/cache:
    lifetime: Infinity
rules:
  jest/no-test-callback: 'off'
  jest/no-disabled-tests: 'off'
  '@typescript-eslint/member-ordering':
    - error
    - default:
        - signature
        - public-static-field
        - protected-static-field
        - private-static-field
        - public-static-method
        - protected-static-method
        - private-static-method
        - public-abstract-field
        - protected-abstract-field
        - private-abstract-field
        - public-instance-field
        - protected-instance-field
        - private-instance-field
        - public-constructor
        - protected-constructor
        - private-constructor
        - public-instance-method
        - protected-instance-method
        - private-instance-method
        - public-abstract-method
        - protected-abstract-method
        - private-abstract-method
  prettier/prettier: error
  jest/lowercase-name:
    - error
    - ignore:
        - describe
  jest/no-hooks:
    - error
    - allow:
        - beforeAll
        - beforeEach
        - afterAll
        - afterEach
  typescript-sort-keys/interface:
    - error
    - asc
    - caseSensitive: true
      natural: true
  typescript-sort-keys/string-enum:
    - error
    - asc
    - caseSensitive: true
      natural: true
  quotes:
    - error
    - backtick
  no-else-return:
    - error
    - allowElseIf: true
  sort-keys:
    - error
    - asc
    - caseSensitive: true
      natural: true
      minKeys: 2
  '@typescript-eslint/no-var-requires': 'off'
  '@typescript-eslint/explicit-function-return-type': 'off'
  '@typescript-eslint/no-unused-vars':
    - error
    - argsIgnorePattern: ^_
  import/no-namespace: 'off'
  import/first: error
  import/exports-last: error
  import/no-duplicates: error
  indent: 'off'
  '@typescript-eslint/naming-convention':
    - error
    - selector: default
      format:
        - camelCase
    - selector: variable
      format:
        - camelCase
        - UPPER_CASE
    - selector: variable
      types:
        - boolean
      format:
        - PascalCase
      prefix:
        - is
        - has
        - should
        - contains
        - as
    - selector: parameter
      format:
        - camelCase
      leadingUnderscore: allow
    - selector: parameter
      types:
        - boolean
      format:
        - PascalCase
      leadingUnderscore: allow
      prefix:
        - is
        - has
        - should
        - contains
        - as
    - selector: function
      format:
        - camelCase
    - selector: memberLike
      modifiers:
        - private
      format:
        - camelCase
      leadingUnderscore: require
    - selector: memberLike
      modifiers:
        - protected
      format:
        - camelCase
      leadingUnderscore: require
    - selector: typeLike
      format:
        - PascalCase
    - selector: typeParameter
      format:
        - PascalCase
      prefix:
        - T
    - selector: interface
      format:
        - PascalCase
      prefix:
        - I
    - selector: enumMember
      format:
        - UPPER_CASE
    - selector: enum
      format:
        - PascalCase
      suffix:
        - Enum
  '@typescript-eslint/no-explicit-any':
    - error
    - fixToUnknown: false
      ignoreRestArgs: false
  object-curly-spacing:
    - error
    - always
  linebreak-style: 'off'
  computed-property-spacing:
    - error
    - never
  array-bracket-spacing: 'off'
  prefer-rest-params: 'off'
  require-jsdoc: 'off'
  max-len: 'off'
  comma-dangle: 'off'
overrides:
  - files:
      - '*.ts'
    rules:
      '@typescript-eslint/explicit-function-return-type':
        - error
        - allowExpressions: false
          allowTypedFunctionExpressions: false
          allowHigherOrderFunctions: false
      '@typescript-eslint/no-var-requires':
        - error

Change Sorting Algorithm or Support Custom Sort Function

Currently,

UPDATE_OFFER_DETAIL: MaterialsState['offerDetail']
UPDATE_OFFERS_LIST: MaterialsState['offerList']

gets sorted because _ is considered to be after S. This unfortunately clashes with expectations and with other sorting extensions.

IMO, the most sustainable solution would be to allow passing a custom Array.prototype.sort callback as an option in the rule. Then, users can configure it exactly as they wish.

Crush

TypeError: Cannot read property 'name' of undefined

  getPropertyName(node) {
    return module.exports.getStaticPropertyName(node) || node.key.name || null;
  },

sample

export interface IFoo {
    (dependencies?: any): (Widget: ComponentType) => ComponentType<any>;
    a: string;
}

crash in typescript-sort-keys/interface on constructor declarations

As a minimal example; if we extend the ClockConstructor interface from the TypeScript documentation with an overload, so that there is something to sort, we get a crash when sorting uses getPropertyName(node) which attempts to read node.key.name, which fails on TSConstructSignatureDeclaration nodes.

Example code to lint:

interface ClockConstructor {
    new (hour: number, minute: number): ClockInterface;
    new (hour: number): ClockInterface;
}
interface ClockInterface {
    tick(): void;
}

Depending on the preferred order wrt. constructor declarations, perhaps replacing the line

return module.exports.getStaticPropertyName(node) || node.key.name || null;

in getPropertyName with

return module.exports.getStaticPropertyName(node) || (node.key && node.key.name) || null;

would be a reasonable solution?

Use Caret (^) for Peer Dependencies

Currently the peer dependencies are specified using a tilde (~) which means that there are peer dependency warnings when using the latest versions of eslint and typescript.

If these were a caret (^) then it would remove these warnings, but still be safe against breaking changes.

Add support for TypeScript >= 5.0

Please consider adding support for TypeScript >= 5.0.

Currently I get the following error when I try to install this plugin with TypeScript 5.0.2 installed in my project:

...
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR!   typescript@"^5.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer typescript@"^3 || ^4" from [email protected]
npm ERR! node_modules/eslint-plugin-typescript-sort-keys
...

Autofix?

Would implementing autofix be an absolute nightmare?

Super-willing to help on this :)

Fix objects must not be overlapped in a report

Hi, I'm receiving this error when I uncomment the interface rule in my eslint config.

yarn 1.22.11
eslint 8.17.0
eslint-plugin-typescript-sort-keys 2.1.0

The offending line: 'typescript-sort-keys/interface': 'warn',

A sample of the input file (it's really long, and I also can't share it directly)

declare namespace A {
    interface Ab extends b {
        d: string;
        n: number;
    }
    interface Ac<T> {
        d: any[];
        t: T;
        type: string;
    }
    interface D {
        /* a comment */
    }
}

declare namespace A.G {
    interface P<T> extends PromiseLike<T> {
        then<U>(
            hello?: (_: T) => P<U>,
            world?: (_: any) => P<U>,
            something?: (_: any) => void,
        ): P<U>;
        cancel(): void;
    }
    type H = P<void>;

    namespace Hello {
        interface V<T> extends Array<T> {
            a(
                value: T,
                ...extra: any[]
            ): { _: number; _1: boolean }
        }
        namespace Z {
            /** Specifies the type of activation. */
            enum ZZ {
                a, b, c
            }
            abstract class J {
                hello: string:
            }
        }
    }
}

What I see:

$ eslint . --ext .ts,.tsx,.js,.jsx --fix --ignore-path ../../../.eslintignore

Oops! Something went wrong! :(

ESLint: 8.17.0

AssertionError [ERR_ASSERTION]: Fix objects must not be overlapped in a report.
    at mergeFixes (C:\Users\me\repo\node_modules\eslint\lib\linter\report-translator.js:167:9)
    at normalizeFixes (C:\Users\me\repo\node_modules\eslint\lib\linter\report-translator.js:197:16)
    at C:\Users\me\repo\node_modules\eslint\lib\linter\report-translator.js:364:49
    at Object.report (C:\Users\me\repo\node_modules\eslint\lib\linter\linter.js:1085:41)
    at C:\Users\me\repo\node_modules\eslint-plugin-typescript-sort-keys\lib\index.cjs.js:296:25
    at TSTypeLiteral (C:\Users\me\repo\node_modules\eslint-plugin-typescript-sort-keys\lib\index.cjs.js:395:24)    
    at ruleErrorHandler (C:\Users\me\repo\node_modules\eslint\lib\linter\linter.js:1114:28)
    at C:\Users\me\repo\node_modules\eslint\lib\linter\safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (C:\Users\me\repo\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error when trying to use this in an ESM context

Hey, I get an error when trying to include this plugin using ES module syntax, the error is:

(node:96667) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

Oops! Something went wrong! :(

ESLint: 8.48.0

/Users/oyvind/dev/eslint-config-tidal/node_modules/eslint-plugin-typescript-sort-keys/lib/index.esm.js:1
import { AST_NODE_TYPES, AST_TOKEN_TYPES, ESLintUtils } from '@typescript-eslint/experimental-utils';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

I tested changing the file name (from lib/index.esm.js to lib/index.mjs) that seems to work for me at least (the other option, setting "type": "module" probably also would work, but that might have bigger consequences for other usages I assume)

Remove restriction on @typescript-eslint/parser version

NPM warnings:

npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: [email protected]
npm WARN Found: @typescript-eslint/[email protected]
npm WARN node_modules/@typescript-eslint/parser
npm WARN   dev @typescript-eslint/parser@"^7.0.1" from the root project
npm WARN   2 more (@tool-belt/eslint-config, @typescript-eslint/eslint-plugin)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer @typescript-eslint/parser@"^6" from [email protected]
npm WARN node_modules/eslint-plugin-typescript-sort-keys
npm WARN   eslint-plugin-typescript-sort-keys@"^3.1.0" from @tool-belt/[email protected]
npm WARN   node_modules/@tool-belt/eslint-config
npm WARN 
npm WARN Conflicting peer dependency: @typescript-eslint/[email protected]
npm WARN node_modules/@typescript-eslint/parser
npm WARN   peer @typescript-eslint/parser@"^6" from [email protected]
npm WARN   node_modules/eslint-plugin-typescript-sort-keys
npm WARN     eslint-plugin-typescript-sort-keys@"^3.1.0" from @tool-belt/[email protected]
npm WARN     node_modules/@tool-belt/eslint-config
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: {
npm WARN EBADENGINE     yarn: 'please-use-npm',
npm WARN EBADENGINE     npm: '>=[10](https://github.com/basemind-ai/bot/actions/runs/7955880378/job/21715588591#step:4:11).4.0',
npm WARN EBADENGINE     pnpm: 'please-use-npm',
npm WARN EBADENGINE     node: '>=v20.0.0'
npm WARN EBADENGINE   },
npm WARN EBADENGINE   current: { node: 'v20.[11](https://github.com/basemind-ai/bot/actions/runs/7955880378/job/21715588591#step:4:12).0', npm: '10.2.4' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.

Specific type of inline comments causes linter failure

type Type1<TKey extends string> = Partial<{
  // %foo
  foo: boolean;
  /* %baz */ baz: boolean;

  /**
   * %bar
   */
  bar: boolean;
  /* %bam */ bam: boolean;
}> & {/* %foo */
  foo: boolean;

// %baz
  baz: boolean;
  /**
   * %bar
   */
  bar?: boolean;
} & {
    [K in keyof TKey]: boolean;
  };

/* %bam */ bam: boolean; line causes linter to fail with Fix objects must not be overlapped in a report.

Receiving Warning: Package eslint-plugin-typescript-sort-keys has been ignored because it contains invalid configuration.

Hey, great package, use it all the time. So thank you.

I have noticed that I get the following warning when I started using your library:

Package eslint-plugin-typescript-sort-keys has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in <redacted>/node_modules/eslint-plugin-typescript-sort-keys/package.json

I think this is because you are using the "exports" property in the package.json file, which explicitly lists the files used by named exports. Because package.json is not a named export, it throws this warning.

This warning is described here. The solution seems to be described here

I believe I can fix this with a simple patch. I will prepare a pull request for your review.

@typescript-eslint/parser@"6.0.0" is out

And this makes impossible to install eslint-plugin-typescript-sort-keys then:

โฏ npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @typescript-eslint/[email protected]
npm ERR! node_modules/@typescript-eslint/parser
npm ERR!   dev @typescript-eslint/parser@"6.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @typescript-eslint/parser@"^1 || ^2 || ^3 || ^4 || ^5" from [email protected]
npm ERR! node_modules/eslint-plugin-typescript-sort-keys
npm ERR!   dev eslint-plugin-typescript-sort-keys@"2.3.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /Users/christianr/.npm/_logs/2023-07-17T13_44_03_317Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/christianr/.npm/_logs/2023-07-17T13_44_03_317Z-debug-0.log

Version 2 does not work with Node.js v15

I wanted to upgrade from eslint-plugin-typescript-sort-keys v1.8.0 to v2.0.0 but it fails in my CI environment using Node.js v15.14.0 with the following message:

error @typescript-eslint/[email protected]: The engine "node" is incompatible with this module. Expected version "^12.22.0 || ^14.17.0 || >=16.0.0". Got "15.14.0"

Can you downgrade @typescript-eslint/experimental-utils to make it work again?

Use `^` to pin dependencies

When using this plugin in a shared config, all users need to manually install this version, probably because this package is hoisted and I'm guessing this is because of the ~ in the package.json. Is there a reason for this? Could these be changed into a ^?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.