0.0.98 • Published 12 months ago

@susisu/eslint-config v0.0.98

Weekly downloads
236
License
MIT
Repository
github
Last release
12 months ago

@susisu/eslint-config

CI

Requirements

  • eslint >= 9.27.0 < 10

Installation

# npm
npm i -D eslint @susisu/eslint-config
# yarn
yarn add -D eslint @susisu/eslint-config
# pnpm
pnpm add -D eslint @susisu/eslint-config

Usage

NOTE: Formatting rules are not enabled. I recommend using Prettier.

The package provides a factory function that configures all language settings and rules for each file type.

Minimum setup

import { config } from "@susisu/eslint-config";

export default config({
  tsconfigRootDir: import.meta.dirname,
});

Options and custom configs

export default config(
  // Options
  {
    // Enable recommended rules. (default: true)
    recommendedRules: true,
    // Default sourceType for .js files.  (default: "module")
    jsSourceType: "module",
    // Set languageOptions.parserOptions.projectService for TypeScript files. (default: true)
    // If both `tsProjectService` and `tsProject` are enabled, only `tsProjectService` will have effect.
    tsProjectService: true,
    // Set languageOptions.parserOptions.project for TypeScript files. (default: false)
    tsProject: false,
    // Set languageOptions.parserOptions.tsconfigRootDir for TypeScript files. (default: undefined)
    tsconfigRootDir: undefined,
    // If true, mixes eslint-config-prettier to disable formatting rules. (default: true)
    prettier: true,
  },
  // Custom configs
  // You can use the same feature as `defineConfig()`, like `extends`.
  // See https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/
  {
    files: ["/path/to/file.js"],
    extends: [somePlugin.recommended],
    rules: {
      "no-console": "off",
    },
  },
);

What does config() do?

  • Set linter options
    • Enable reportUnusedDisableDirectives
    • Enable reportUnusedInlineConfigs
  • Install plugins
  • Set language options for JS and TS files
    • Set sourceType: "module" for .js, .mjs, .ts, .tsx, .cts, .mts
    • Set sourceType: "commonjs" for .cjs
    • Enable typescript-eslint parser and typed linting for TS files
  • Enable recommended rules
  • Apply custom configs
  • Disable rules conflicting with Prettier

See the source code for more details.

Error levels

  • error: problems that should be fixed in most of the projects and contexts
  • warn: problems that might be fixed depending on the project or context, or just notifications (like highlighting TODO comments)

License

MIT License

Author

Susisu (GitHub, Twitter)

0.0.97

1 year ago

0.0.98

12 months ago

0.0.95

1 year ago

0.0.96

1 year ago

0.0.94

1 year ago

0.0.92

1 year ago

0.0.93

1 year ago

0.0.91

2 years ago

0.0.84

2 years ago

0.0.85

2 years ago

0.0.86

2 years ago

0.0.87

2 years ago

0.0.88

2 years ago

0.0.89

2 years ago

0.0.83

2 years ago

0.0.90

2 years ago

0.0.82

2 years ago

0.0.81

2 years ago

0.0.80

2 years ago

0.0.79

2 years ago

0.0.77

2 years ago

0.0.78

2 years ago

0.0.76

2 years ago

0.0.75

2 years ago

0.0.74

2 years ago

0.0.73

2 years ago

0.0.70

2 years ago

0.0.71

2 years ago

0.0.72

2 years ago

0.0.65

3 years ago

0.0.66

3 years ago

0.0.67

3 years ago

0.0.68

3 years ago

0.0.69

3 years ago

0.0.64

3 years ago

0.0.62

3 years ago

0.0.63

3 years ago

0.0.61

3 years ago

0.0.60

3 years ago

0.0.59

3 years ago

0.0.55

4 years ago

0.0.56

4 years ago

0.0.57

4 years ago

0.0.58

4 years ago

0.0.54

4 years ago

0.0.51

4 years ago

0.0.52

4 years ago

0.0.53

4 years ago

0.0.50

4 years ago

0.0.49

4 years ago

0.0.47

4 years ago

0.0.48

4 years ago

0.0.43

4 years ago

0.0.44

4 years ago

0.0.45

4 years ago

0.0.46

4 years ago

0.0.42

4 years ago

0.0.41

5 years ago

0.0.40

5 years ago

0.0.39

5 years ago

0.0.38

5 years ago

0.0.37

5 years ago

0.0.36

5 years ago

0.0.35

5 years ago

0.0.34

5 years ago

0.0.33

5 years ago

0.0.32

5 years ago

0.0.31

5 years ago

0.0.30

5 years ago

0.0.29

5 years ago

0.0.28

6 years ago

0.0.27

6 years ago

0.0.26

6 years ago

0.0.25

6 years ago

0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.18

6 years ago

0.0.19

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago