@bonniernews/eslint-config 1.0.1 → 1.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ - Add rule `react/jsx-curly-spacing` to align jsx curly with js curly.
6
+ - Bumped `eslint-plugin-react`, `eslint-plugin-import` and `eslint-plugin-n`.
7
+ - Moved TypeScript restricted syntax to a seperate package `@bonniernews/typescript-rules`.
8
+ - Uses `@bonniernews/typescript-rules` for TypeScript.
9
+ - Added `@bonniernews/typescript-rules/disallow-class-extends` also for non-typescript.
10
+
11
+ ## 1.0.2
12
+
13
+ - Run tests on all supported node versions
14
+ - Bump `@typescript-eslint/eslint-plugin` and `@typescript-eslint/parser`.
15
+ - Use typescript 5.3 for tests
16
+
3
17
  ## 1.0.1
4
18
 
5
19
  - Loosen react/jsx-max-props-per-line to allow as many props the developer wants on
package/index.js CHANGED
@@ -19,7 +19,7 @@ const moduleConfig = {
19
19
  node: true,
20
20
  ...(hasES2022Support ? { es2022: true } : { es6: true }),
21
21
  },
22
- plugins: [ "eslint-plugin-n", "import" ],
22
+ plugins: [ "eslint-plugin-n", "import", "@bonniernews/typescript-rules" ],
23
23
  };
24
24
 
25
25
  const commonjsConfig = {
@@ -28,7 +28,7 @@ const commonjsConfig = {
28
28
  node: true,
29
29
  es6: true,
30
30
  },
31
- plugins: [ "eslint-plugin-n" ],
31
+ plugins: [ "eslint-plugin-n", "@bonniernews/typescript-rules" ],
32
32
  };
33
33
 
34
34
  module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonniernews/eslint-config",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "ESLint config",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,11 +20,11 @@
20
20
  ],
21
21
  "contributors": [],
22
22
  "devDependencies": {
23
- "chai": "^4.3.7",
24
- "eslint": "^8.19.0",
23
+ "chai": "^4.3.10",
24
+ "eslint": "^8.53.0",
25
25
  "mocha": "^10.2.0",
26
26
  "mocha-cakes-2": "^3.3.0",
27
- "typescript": "^5.2.0"
27
+ "typescript": "^5.3.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "eslint": ">=8.3.0",
@@ -40,13 +40,14 @@
40
40
  },
41
41
  "license": "MIT",
42
42
  "dependencies": {
43
- "@typescript-eslint/eslint-plugin": "^6.6.0",
44
- "@typescript-eslint/parser": "^6.6.0",
43
+ "@bonniernews/eslint-plugin-typescript-rules": "^0.9.0",
44
+ "@typescript-eslint/eslint-plugin": "^6.12.0",
45
+ "@typescript-eslint/parser": "^6.12.0",
45
46
  "eslint-plugin-chai-friendly": "^0.7.2",
46
- "eslint-plugin-import": "^2.27.5",
47
- "eslint-plugin-n": "^16.0.1",
47
+ "eslint-plugin-import": "^2.29.0",
48
+ "eslint-plugin-n": "^16.3.1",
48
49
  "eslint-plugin-no-only-tests": "^3.1.0",
49
- "eslint-plugin-react": "^7.32.2"
50
+ "eslint-plugin-react": "^7.33.2"
50
51
  },
51
52
  "files": [
52
53
  "all.js",
package/react-rules.js CHANGED
@@ -36,4 +36,5 @@ module.exports = {
36
36
  "react/jsx-indent": [ 2, 2 ],
37
37
  "react/jsx-tag-spacing": [ 2, { beforeSelfClosing: "always" } ],
38
38
  "react/jsx-indent-props": [ 2, 2 ],
39
+ "react/jsx-curly-spacing": [ "error", { when: "never", children: { when: "always" } } ],
39
40
  };
package/rules.js CHANGED
@@ -236,6 +236,7 @@ module.exports = function getRules(isModuleProject) {
236
236
  ...starterAppRules,
237
237
  ...(isModuleProject ? importRules : {}),
238
238
  // good stuff..
239
+ "@bonniernews/typescript-rules/disallow-class-extends": "error",
239
240
  "no-multiple-empty-lines": [ "error", {
240
241
  max: 1,
241
242
  maxEOF: 0,
@@ -30,32 +30,6 @@ const typescriptEslintRecommended = {
30
30
  "@typescript-eslint/triple-slash-reference": "error",
31
31
  };
32
32
 
33
- const disallowNonEcmaScriptCompatibleSyntax = {
34
- "no-restricted-syntax": [
35
- "error",
36
- {
37
- selector: "ClassDeclaration[abstract=true]",
38
- message: "Abstract classes aren't allowed.",
39
- },
40
- {
41
- selector: "PropertyDefinition[accessibility=private]",
42
- message: "Private keyword isn't allowed, use native # instead.",
43
- },
44
- {
45
- selector: "MethodDefinition[decorators.length > 0]",
46
- message: "Decorators aren't allowed.",
47
- },
48
- {
49
- selector: "TSEnumDeclaration",
50
- message: "Don't use enums since it is not a type-level extension of JavaScript. Use Objects instead.",
51
- },
52
- {
53
- selector: "ClassDeclaration[superClass]",
54
- message: "Extending other classes via inheritance isn't allowed. Use composition instead.",
55
- },
56
- ],
57
- };
58
-
59
33
  const eslitRecommendedTs = {
60
34
  "constructor-super": "off", // ts(2335) & ts(2377)
61
35
  "getter-return": "off", // ts(2378)
@@ -84,7 +58,8 @@ const importRules = { "import/named": "off" };
84
58
 
85
59
  module.exports = {
86
60
  ...typescriptEslintRecommended,
87
- ...disallowNonEcmaScriptCompatibleSyntax,
88
61
  ...eslitRecommendedTs,
89
62
  ...importRules,
63
+ "@bonniernews/typescript-rules/disallow-abstract-class": "error",
64
+ "@bonniernews/typescript-rules/disallow-non-es-compatible": "error",
90
65
  };