@rotki/eslint-config 3.7.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,19 +2,61 @@
2
2
 
3
3
  [![npm (scoped)](https://img.shields.io/npm/v/@rotki/eslint-config?style=flat-square)](https://www.npmjs.com/package/@rotki/eslint-config)
4
4
 
5
- Inspired by [@antfu/eslint-config](https://github.com/antfu/eslint-config) and [@sxzz/eslint-config](https://github.com/sxzz/eslint-config).
5
+ A comprehensive ESLint configuration preset for [rotki](https://github.com/rotki) TypeScript and JavaScript repositories. Based on [@antfu/eslint-config](https://github.com/antfu/eslint-config) and inspired by [@sxzz/eslint-config](https://github.com/sxzz/eslint-config).
6
6
 
7
- A common configuration to be used across the different [rotki](https://github.com/rotki) TypeScript and JavaScript repositories.
7
+ ## Table of Contents
8
8
 
9
- ## Usage
9
+ - [Features](#features)
10
+ - [Requirements](#requirements)
11
+ - [Installation](#installation)
12
+ - [Usage](#usage)
13
+ - [Basic Configuration](#basic-configuration)
14
+ - [Vue I18n Support](#vue-i18n-support)
15
+ - [TypeScript Configuration](#typescript-configuration)
16
+ - [Editor Integration](#editor-integration)
17
+ - [Troubleshooting](#troubleshooting)
18
+ - [Contributing](#contributing)
19
+ - [License](#license)
20
+
21
+ ## Features
22
+
23
+ - 📝 TypeScript and JavaScript support
24
+ - 🔧 Auto-fixable rules
25
+ - 🌐 Vue I18n integration
26
+ - ⚡ Editor-aware configurations
27
+ - 🛠️ Preconfigured best practices
28
+
29
+ ## Requirements
10
30
 
11
- ### Install
31
+ - Node.js >=20 < 21
32
+ - ESLint >=9.10.0
33
+ - TypeScript >=5.0.0 (for TypeScript support)
12
34
 
35
+ ## Installation
36
+
37
+ Using pnpm (recommended):
38
+
39
+ ```bash
40
+ pnpm add -D eslint @rotki/eslint-config
13
41
  ```
14
- pnpm i -D eslint @rotki/eslint-config
42
+
43
+ Using npm:
44
+
45
+ ```bash
46
+ npm install --save-dev eslint @rotki/eslint-config
47
+ ```
48
+
49
+ Using yarn:
50
+
51
+ ```bash
52
+ yarn add -D eslint @rotki/eslint-config
15
53
  ```
16
54
 
17
- ### Config `eslint.config.mjs`
55
+ ## Usage
56
+
57
+ ### Basic Configuration
58
+
59
+ Create an `eslint.config.ts` file in your project root:
18
60
 
19
61
  ```js
20
62
  import rotki from '@rotki/eslint-config';
@@ -23,9 +65,7 @@ import rotki from '@rotki/eslint-config';
23
65
  export default rotki();
24
66
  ```
25
67
 
26
- ### Add script for package.json
27
-
28
- For example:
68
+ Add scripts to your `package.json`:
29
69
 
30
70
  ```json
31
71
  {
@@ -36,26 +76,29 @@ For example:
36
76
  }
37
77
  ```
38
78
 
39
- ### @intlify/eslint-plugin-vue-i18n
79
+ ### Vue I18n Support
80
+
81
+ For projects using Vue I18n, configure the plugin in your `eslint.config.ts`:
40
82
 
41
83
  ```js
42
- // eslint.config.mjs
84
+ import path from 'node:path';
43
85
  import rotki from '@rotki/eslint-config';
44
86
 
45
87
  // eslint-disable-next-line import/no-default-export
46
88
  export default rotki({
47
89
  vueI18n: {
48
- src: path.join('app', 'src'), // defaults to src for @intlify/vue-i18n/no-unused-keys,
49
- localeDir: 'locales', // that would be under app/src/
50
- ignores: [], // for @intlify/vue-i18n/no-unused-keys
90
+ src: path.join('app', 'src'), // Source directory
91
+ localeDir: 'locales', // Locales directory
92
+ ignores: [], // Ignored paths
51
93
  },
52
94
  });
53
95
  ```
54
96
 
55
- ### TypeScript Aware Rules
97
+ ### TypeScript Configuration
98
+
99
+ For TypeScript projects, specify your `tsconfig.json` location:
56
100
 
57
101
  ```js
58
- // eslint.config.mjs
59
102
  import rotki from '@rotki/eslint-config';
60
103
 
61
104
  // eslint-disable-next-line import/no-default-export
@@ -66,6 +109,27 @@ export default rotki({
66
109
  });
67
110
  ```
68
111
 
112
+ ## Editor Integration
113
+
114
+ This configuration includes special handling for editor environments. The following rules are disabled during editing but enabled during CI/CD:
115
+
116
+ - [`prefer-const`](https://eslint.org/docs/rules/prefer-const)
117
+ - [`test/no-only-tests`](https://github.com/levibuzolic/eslint-plugin-no-only-tests)
118
+ - [`unused-imports/no-unused-imports`](https://www.npmjs.com/package/eslint-plugin-unused-imports)
119
+
120
+ This improves the development experience while maintaining code quality in production.
121
+
122
+ ## Troubleshooting
123
+
124
+ Common issues and their solutions:
125
+
126
+ - If you encounter parsing errors, ensure your TypeScript version matches the requirements
127
+ - For Vue I18n issues, verify your directory structure matches the configuration
128
+
129
+ ## Contributing
130
+
131
+ Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
132
+
69
133
  ## License
70
134
 
71
135
  [AGPL-3.0](./LICENSE) License &copy; 2023- [Rotki Solutions GmbH](https://github.com/rotki)