Skip to content

Commit cf577fd

Browse files
authored
Merge pull request #1844 from cosmos/simplify-eslint-flat-config-simon
Simplify eslint flat config (v2)
2 parents cfd9191 + edea22b commit cf577fd

File tree

6 files changed

+11
-68
lines changed

6 files changed

+11
-68
lines changed

.pnp.cjs

Lines changed: 0 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.yarn/cache/@eslint-compat-npm-1.3.1-41a44c7960-8dfcea5ecb.zip

Lines changed: 0 additions & 3 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import { fixupPluginRules } from "@eslint/compat";
21
import js from "@eslint/js";
32
import typescriptEslint from "@typescript-eslint/eslint-plugin";
4-
import tsParser from "@typescript-eslint/parser";
53
import importt from "eslint-plugin-import";
64
import prettier from "eslint-plugin-prettier/recommended";
75
import simpleImportSort from "eslint-plugin-simple-import-sort";
@@ -13,11 +11,10 @@ export default [
1311
},
1412
js.configs.recommended,
1513
prettier,
16-
// importt.flatConfigs.recommended,
14+
importt.flatConfigs.recommended,
1715
{
1816
plugins: {
1917
"simple-import-sort": simpleImportSort,
20-
import: fixupPluginRules(importt),
2118
},
2219

2320
languageOptions: {
@@ -30,6 +27,12 @@ export default [
3027
ecmaVersion: 2022,
3128
},
3229

30+
settings: {
31+
"import/resolver": {
32+
typescript: {},
33+
},
34+
},
35+
3336
rules: {
3437
curly: ["warn", "multi-line", "consistent"],
3538
"no-bitwise": "warn",
@@ -55,41 +58,26 @@ export default [
5558
},
5659
],
5760

58-
"import/no-cycle": "off",
5961
"simple-import-sort/imports": "warn",
6062
"simple-import-sort/exports": "warn",
6163
},
6264
},
65+
{ files: ["**/*.ts"], ...importt.flatConfigs.typescript },
66+
...typescriptEslint.configs["flat/strict-type-checked"].map((c) => ({ files: ["**/*.ts"], ...c })),
6367
{
6468
files: ["**/*.ts"],
6569

66-
plugins: {
67-
"@typescript-eslint": fixupPluginRules(typescriptEslint),
68-
},
69-
7070
languageOptions: {
71-
parser: tsParser,
7271
ecmaVersion: 2022,
7372

7473
parserOptions: {
7574
project: true,
7675
},
7776
},
7877

79-
settings: {
80-
"import/resolver": {
81-
typescript: {},
82-
},
83-
},
84-
8578
rules: {
8679
"no-shadow": "off",
8780
"no-unused-vars": "off",
88-
...typescriptEslint.configs["flat/strict-type-checked"].reduce(
89-
(obj, c) => Object.assign(obj, c.rules),
90-
{},
91-
),
92-
...importt.flatConfigs.typescript.rules,
9381

9482
// lints from 'strict-type-checked' config
9583
"@typescript-eslint/no-deprecated": "off",

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
"@cosmjs/encoding": "workspace:^",
4747
"@cosmjs/proto-signing": "workspace:^",
4848
"@cosmjs/stargate": "workspace:^",
49-
"@eslint/compat": "^1.3.1",
5049
"@eslint/js": "^9.32.0",
5150
"@typescript-eslint/eslint-plugin": "^8.39.0",
5251
"@typescript-eslint/parser": "^8.39.0",

packages/ledger-amino/src/ledgerconnector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { assert } from "@cosmjs/utils";
66
import Transport from "@ledgerhq/hw-transport";
77
// eslint-disable-next-line @typescript-eslint/naming-convention
88
import CosmosApp from "@zondax/ledger-cosmos-js";
9-
import semver from "semver";
9+
import semverGte from "semver/functions/gte.js";
1010

1111
const cosmosHdPath = makeCosmoshubPath(0);
1212
const cosmosBech32Prefix = "cosmos";
@@ -125,7 +125,7 @@ export class LedgerConnector {
125125

126126
private async verifyAppVersion(): Promise<void> {
127127
const version = await this.getCosmosAppVersion();
128-
if (!semver.gte(version, this.minLedgerAppVersion)) {
128+
if (!semverGte(version, this.minLedgerAppVersion)) {
129129
throw new Error(
130130
`Outdated version: Please update ${this.ledgerAppName} Ledger App to the latest version.`,
131131
);

yarn.lock

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -812,18 +812,6 @@ __metadata:
812812
languageName: node
813813
linkType: hard
814814

815-
"@eslint/compat@npm:^1.3.1":
816-
version: 1.3.1
817-
resolution: "@eslint/compat@npm:1.3.1"
818-
peerDependencies:
819-
eslint: ^8.40 || 9
820-
peerDependenciesMeta:
821-
eslint:
822-
optional: true
823-
checksum: 10c0/8dfcea5ecb854111f9c0acc23a469e0a25cdaddceb5fb40c47988c247d6e32ec199bcd00f1b8ba9ed779228526552703c4b74948169e78b78b5fd814e04b042b
824-
languageName: node
825-
linkType: hard
826-
827815
"@eslint/config-array@npm:^0.21.0":
828816
version: 0.21.0
829817
resolution: "@eslint/config-array@npm:0.21.0"
@@ -3087,7 +3075,6 @@ __metadata:
30873075
"@cosmjs/encoding": "workspace:^"
30883076
"@cosmjs/proto-signing": "workspace:^"
30893077
"@cosmjs/stargate": "workspace:^"
3090-
"@eslint/compat": "npm:^1.3.1"
30913078
"@eslint/js": "npm:^9.32.0"
30923079
"@typescript-eslint/eslint-plugin": "npm:^8.39.0"
30933080
"@typescript-eslint/parser": "npm:^8.39.0"

0 commit comments

Comments
 (0)