0.0.88 • Published 4 days ago

eslint-import-resolver-typescript-bun v0.0.88

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 days ago

eslint-import-resolver-typescript-bun

GitHub Actions npm GitHub Release

Conventional Commits projen

This plugin simply adds workarounds to eslint-import-resolver-typescript when resolving Bun's modules.

You can use eslint-plugin-import on your Bun project directly with this resolver!

How it works

This resolver reads bun-types and list all Bun modules defined there. Currently, we assume all Bun modules start with bun e.g. bun, bun:test, etc.

Then, when resolving, if the requested module is one of the Bun modules detected above, the resolver returns { found: true, path: null }. Otherwise, it delegates to eslint-import-resolver-typescript.

Installation

# npm
npm i -D eslint-plugin-import eslint-import-resolver-typescript-bun

# pnpm
pnpm i -D eslint-plugin-import eslint-import-resolver-typescript-bun

# yarn
yarn add -D eslint-plugin-import eslint-import-resolver-typescript-bun

Configuration

All configurations are passed to eslint-import-resolver-typescript. Simply replace your resolver name from typescript to typescript-bun!

module.exports = {
  extends: ["plugin:import/recommended", "plugin:import/typescript"],
  parser: "@typescript-eslint/parser",
  parserOptions: {
    project: true,
  },
  plugins: ["@typescript-eslint"],
  root: true,
  settings: {
    "import/parsers": {
      "@typescript-eslint/parser": [".ts", ".tsx"],
    },
    "import/resolver": {
      "typescript-bun": {
        // ^^ HERE! ^^
        project: true,
        alwaysTryTypes: true,
      },
    },
  },
  rules: {
    "import/order": [
      "warn",
      {
        groups: ["builtin", "external"],
        alphabetize: {
          order: "asc",
          caseInsensitive: true,
        },
      },
    ],
  },
};

See eslint-import-resolver-typescript configuration here.

Debug

Use DEBUG environment variable provided by debug:

$ DEBUG=eslint-import-resolver-typescript\* bun x eslint src/index.ts
  eslint-import-resolver-typescript looking for: bun-types +0ms
  eslint-import-resolver-typescript matched node path: /workspaces/asideline/node_modules/bun-types/types.d.ts +101ms
  eslint-import-resolver-typescript-bun found bun modules: Set(5) { 'bun', 'bun:test', 'bun:sqlite', 'bun:jsc', 'bun:ffi' } +0ms
  eslint-import-resolver-typescript-bun matched bun modules: bun:test +2ms

Development

This project uses Projen and Yarn 1.

git clone https://github.com/opsbr/eslint-import-resolver-typescript-bun.git
cd eslint-import-resolver-typescript-bun
yarn install
yarn build

Acknowledgement

Author

OpsBR Software Technology Inc.

License

Apache-2.0

0.0.88

4 days ago

0.0.87

11 days ago

0.0.86

18 days ago

0.0.85

25 days ago

0.0.84

1 month ago

0.0.83

1 month ago

0.0.82

2 months ago

0.0.81

2 months ago

0.0.80

2 months ago

0.0.79

2 months ago

0.0.78

2 months ago

0.0.77

3 months ago

0.0.76

3 months ago

0.0.75

3 months ago

0.0.74

3 months ago

0.0.73

4 months ago

0.0.72

4 months ago

0.0.71

4 months ago

0.0.70

4 months ago

0.0.69

5 months ago

0.0.68

5 months ago

0.0.67

5 months ago

0.0.62

6 months ago

0.0.63

6 months ago

0.0.64

6 months ago

0.0.65

5 months ago

0.0.66

5 months ago

0.0.60

7 months ago

0.0.61

6 months ago

0.0.59

7 months ago

0.0.40

8 months ago

0.0.41

8 months ago

0.0.42

8 months ago

0.0.43

8 months ago

0.0.44

8 months ago

0.0.45

8 months ago

0.0.46

8 months ago

0.0.47

7 months ago

0.0.37

8 months ago

0.0.38

8 months ago

0.0.39

8 months ago

0.0.30

8 months ago

0.0.31

8 months ago

0.0.32

8 months ago

0.0.33

8 months ago

0.0.34

8 months ago

0.0.35

8 months ago

0.0.36

8 months ago

0.0.26

8 months ago

0.0.27

8 months ago

0.0.28

8 months ago

0.0.29

8 months ago

0.0.23

8 months ago

0.0.24

8 months ago

0.0.25

8 months ago

0.0.51

7 months ago

0.0.52

7 months ago

0.0.53

7 months ago

0.0.54

7 months ago

0.0.55

7 months ago

0.0.56

7 months ago

0.0.57

7 months ago

0.0.58

7 months ago

0.0.50

7 months ago

0.0.49

7 months ago

0.0.20

8 months ago

0.0.21

8 months ago

0.0.22

8 months ago

0.0.15

9 months ago

0.0.16

9 months ago

0.0.17

9 months ago

0.0.18

8 months ago

0.0.19

8 months ago

0.0.10

9 months ago

0.0.11

9 months ago

0.0.12

9 months ago

0.0.13

9 months ago

0.0.14

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.5

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago

0.0.0

10 months ago