eslint-plugin-chai-friendly 1.0.1 → 1.1.1

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.
Files changed (3) hide show
  1. package/README.md +36 -0
  2. package/lib/index.js +23 -24
  3. package/package.json +26 -8
package/README.md CHANGED
@@ -101,3 +101,39 @@ More info in the original rule's [docs](http://eslint.org/docs/rules/no-unused-e
101
101
  ## Supported Rules
102
102
 
103
103
  - `chai-friendly/no-unused-expressions`
104
+
105
+ ## TypeScript Compatibility
106
+
107
+ If you're using TypeScript with `@typescript-eslint`, you need to disable both the original ESLint rule and the TypeScript ESLint version:
108
+
109
+ ESLint 9 flat config format:
110
+
111
+ ```js
112
+ import pluginChaiFriendly from 'eslint-plugin-chai-friendly';
113
+
114
+ export default {
115
+ plugins: {'chai-friendly': pluginChaiFriendly},
116
+ rules: {
117
+ "no-unused-expressions": "off", // disable original rule
118
+ "@typescript-eslint/no-unused-expressions": "off", // disable TypeScript ESLint version
119
+ "chai-friendly/no-unused-expressions": "error"
120
+ },
121
+ };
122
+ ```
123
+
124
+ Legacy `.eslintrc` format:
125
+
126
+ ```json
127
+ {
128
+ "plugins": [
129
+ "chai-friendly"
130
+ ],
131
+ "rules": {
132
+ "no-unused-expressions": 0, // disable original rule
133
+ "@typescript-eslint/no-unused-expressions": 0, // disable TypeScript ESLint version
134
+ "chai-friendly/no-unused-expressions": 2
135
+ }
136
+ }
137
+ ```
138
+
139
+ Note that if you use the recommended configuration, both rules will be disabled automatically.
package/lib/index.js CHANGED
@@ -14,33 +14,32 @@ const plugin = {
14
14
  'no-unused-expressions': require('./rules/no-unused-expressions')
15
15
  },
16
16
  processors: {},
17
- configs: {}
18
- };
19
-
20
- // assign configs here so we can reference `plugin`
21
- Object.assign(plugin.configs, {
22
- // Compatible with ESLint v9 flat configs
23
- recommendedFlat: {
24
- name: 'chai-friendly/recommendedFlat',
25
- plugins: {
26
- 'chai-friendly': plugin
17
+ configs: {
18
+ // Compatible with ESLint v9 flat configs
19
+ recommendedFlat: {
20
+ name: 'chai-friendly/recommendedFlat',
21
+ plugins: {},
22
+ rules: {
23
+ 'chai-friendly/no-unused-expressions': 'error',
24
+ 'no-unused-expressions': 'off',
25
+ '@typescript-eslint/no-unused-expressions': 'off' // disable TypeScript ESLint version
26
+ }
27
27
  },
28
- rules: {
29
- 'chai-friendly/no-unused-expressions': 'error',
30
- 'no-unused-expressions': 'off'
31
- }
32
- },
33
28
 
34
- // Compatible with ESLint <9 eslintrc configs
35
- recommended: {
36
- plugins: [
37
- 'chai-friendly'
38
- ],
39
- rules: {
40
- 'no-unused-expressions': 0, // disable original rule
41
- 'chai-friendly/no-unused-expressions': 2
29
+ // Compatible with ESLint <9 eslintrc configs
30
+ recommended: {
31
+ plugins: [
32
+ 'chai-friendly'
33
+ ],
34
+ rules: {
35
+ 'no-unused-expressions': 0, // disable original rule
36
+ '@typescript-eslint/no-unused-expressions': 0, // disable TypeScript ESLint version
37
+ 'chai-friendly/no-unused-expressions': 2
38
+ }
42
39
  }
43
40
  }
44
- },)
41
+ };
42
+
43
+ plugin.configs.recommendedFlat.plugins['chai-friendly'] = plugin;
45
44
 
46
45
  module.exports = plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-chai-friendly",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "This plugin makes 'no-unused-expressions' rule friendly towards chai expect statements.",
5
5
  "keywords": [
6
6
  "eslint",
@@ -27,19 +27,37 @@
27
27
  ],
28
28
  "scripts": {
29
29
  "lint": "eslint .",
30
- "test": "nyc mocha tests --recursive",
31
- "integration-test": "npx eslint examples/test.js --no-ignore"
30
+ "test": "npm run test:unit && npm run integration-test:all",
31
+ "test:types": "npx tsc -p tests/types/tsconfig.json",
32
+ "test:unit": "nyc mocha tests/ --recursive",
33
+ "integration-test": "npx eslint examples/test.js --no-ignore",
34
+ "integration-test:ts": "npx eslint --config examples/eslint.config.js examples/test-ts-specific.ts --no-ignore",
35
+ "integration-test:all": "npx eslint --config examples/eslint.config.js examples/test.js examples/test-ts-specific.ts --no-ignore"
32
36
  },
33
37
  "peerDependencies": {
34
38
  "eslint": ">=3.0.0"
35
39
  },
36
40
  "devDependencies": {
37
- "@babel/core": "^7.23.7",
38
- "@babel/eslint-parser": "^7.23.3",
41
+ "@babel/core": "^7.25.2",
42
+ "@babel/eslint-parser": "^7.25.1",
43
+ "@typescript-eslint/eslint-plugin": "^8.57.0",
44
+ "@typescript-eslint/parser": "^8.57.0",
39
45
  "chai": "^5.1.1",
40
- "eslint": "^9.3.0",
41
- "mocha": "^10.0.0",
42
- "nyc": "^15.1.0"
46
+ "eslint": "^9.39.4",
47
+ "mocha": "^11.7.5",
48
+ "nyc": "^18.0.0",
49
+ "typescript": "^5.8.3"
50
+ },
51
+ "overrides": {
52
+ "flatted": "3.4.1",
53
+ "serialize-javascript": "7.0.4",
54
+ "@istanbuljs/load-nyc-config": {
55
+ "js-yaml": "3.14.2"
56
+ },
57
+ "mocha": {
58
+ "diff": "8.0.3",
59
+ "js-yaml": "4.1.1"
60
+ }
43
61
  },
44
62
  "engines": {
45
63
  "node": ">=0.10.0"