@haraka/eslint-config 1.1.0 → 1.1.2

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
@@ -4,7 +4,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
4
4
 
5
5
  ### Unreleased
6
6
 
7
- #### [1.1.0] - 2024-04-06
7
+ #### [1.1.2] - 2024-04-06
8
+
9
+ - remove rule no-newline-no-curly-if
10
+ - remove haraka:recommended
11
+ - remove rules included in eslint:recommended
12
+
13
+ #### 1.1.0 - 2024-04-06
8
14
 
9
15
  - chore: update to eslint 8 standards
10
16
  - publish as @haraka/eslint-config
@@ -86,3 +92,4 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
86
92
  [1.0.11]: https://github.com/haraka/haraka-eslint/releases/tag/1.0.11
87
93
  [1.0.15]: https://github.com/haraka/haraka-eslint/releases/tag/1.0.15
88
94
  [1.0.16]: https://github.com/haraka/haraka-eslint/releases/tag/v1.0.16
95
+ [1.1.2]: https://github.com/haraka/haraka-eslint/releases/tag/v1.1.2
package/README.md CHANGED
@@ -7,24 +7,26 @@
7
7
 
8
8
  ## Install
9
9
 
10
- In your Haraka plugin:
10
+ In your Haraka module:
11
11
 
12
- 1. Install an eslint config file:
12
+ 1. Add to NPM dependencies:
13
+
14
+ `npm install --save-dev @haraka/eslint-config`
15
+
16
+ 2. Configure eslint:
13
17
 
14
18
  ```sh
15
- tee .eslintrc.yaml <<EOLINT
16
- extends: [ @haraka ]
17
- EOLINT
19
+ echo 'extends: "@haraka"' > .eslintrc.yaml
18
20
  ```
19
21
 
20
- 2. Add to the "scripts" section of `package.json`:
22
+ 3. Add to the "scripts" section of `package.json`:
21
23
 
22
24
  ```json
23
25
  "lint": "npx eslint@8 *.js test"
24
26
  "lint:fix": "npx eslint@8 --fix *.js test"
25
27
  ```
26
28
 
27
- 3. Within your CI workflow:
29
+ 4. Within your CI workflow:
28
30
 
29
31
  `npm run lint`
30
32
 
@@ -34,11 +36,11 @@ To check your project against lint rules:
34
36
 
35
37
  `npm run lint`
36
38
 
37
- Step #3 above does this automatically when CI tests are set up.
39
+ Step #4 above does this automatically when CI tests are set up.
38
40
 
39
41
  If you agree with the lint suggestions, you can run `npm run lint:fix` and the changes will be made to your files automatically.
40
42
 
41
- You can add custom rules to your .eslintrc file.
43
+ Custom rules can be added to the .eslintrc file.
42
44
 
43
45
  <!-- leave these buried at the bottom of the document -->
44
46
 
@@ -46,5 +48,5 @@ You can add custom rules to your .eslintrc file.
46
48
  [ci-url]: https://github.com/haraka/haraka-eslint/actions/workflows/ci.yml
47
49
  [clim-img]: https://codeclimate.com/github/haraka/haraka-eslint/badges/gpa.svg
48
50
  [clim-url]: https://codeclimate.com/github/haraka/haraka-eslint
49
- [npm-img]: https://nodei.co/npm/eslint-plugin-haraka.png
50
- [npm-url]: https://www.npmjs.com/package/eslint-plugin-haraka
51
+ [npm-img]: https://nodei.co/npm/@haraka/eslint-config.png
52
+ [npm-url]: https://www.npmjs.com/package/@haraka/eslint-config
package/index.js CHANGED
@@ -1,55 +1,27 @@
1
1
  "use strict";
2
2
 
3
- // 0 = off
4
- // 1 = warn
5
- // 2 = error
6
-
7
- const envs = {
8
- node: true,
9
- es6: true,
10
- mocha: true,
11
- };
12
-
13
- const globals = {
14
- OK: true,
15
- CONT: true,
16
- DENY: true,
17
- DENYSOFT: true,
18
- DENYDISCONNECT: true,
19
- DENYSOFTDISCONNECT: true,
20
- };
21
-
22
- const recommendedRules = {
23
- "dot-notation": "error",
24
- "one-var": ["error", "never"],
25
- "no-empty": ["error", { allowEmptyCatch: true }],
26
- "no-shadow": "error",
27
- "no-undef": "warn",
28
- "no-unused-vars": ["warn", { args: "none" }],
29
- "no-console": "off",
30
- "no-path-concat": "error",
31
- "no-cond-assign": ["error", "except-parens"],
32
- "no-constant-condition": ["error", { checkLoops: false }],
33
- "prefer-const": ["error", { ignoreReadBeforeAssign: true }],
34
- "no-var": "error",
35
- "object-shorthand": ["warn", "always"],
36
- "prefer-template": "warn",
37
- };
38
-
39
3
  module.exports = {
40
- env: envs,
4
+ env: {
5
+ node: true,
6
+ es6: true,
7
+ mocha: true,
8
+ },
41
9
  root: true,
42
10
  extends: "eslint:recommended",
43
- globals: globals,
44
- rules: {
45
- "no-newline-no-curly-if": require("./rules/no-newline-no-curly-if"),
11
+ globals: {
12
+ OK: true,
13
+ CONT: true,
14
+ DENY: true,
15
+ DENYSOFT: true,
16
+ DENYDISCONNECT: true,
17
+ DENYSOFTDISCONNECT: true,
46
18
  },
47
- configs: {
48
- recommended: {
49
- env: envs,
50
- extends: "eslint:recommended",
51
- globals: globals,
52
- rules: recommendedRules,
53
- },
19
+ rules: {
20
+ // 0 = off // 1 = warn // 2 = error
21
+ "no-empty": ["error", { allowEmptyCatch: true }],
22
+ "no-undef": "warn",
23
+ "no-console": "off",
24
+ "no-constant-condition": ["error", { checkLoops: false }],
25
+ "prefer-const": ["error", { ignoreReadBeforeAssign: true }],
54
26
  },
55
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haraka/eslint-config",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "eslint config for Haraka projects",
5
5
  "keywords": [
6
6
  "eslint",
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- exports.meta = {
4
- docs: {
5
- description: "disallow if() with a single following line and no curlies",
6
- category: "Possible Errors",
7
- recommended: true,
8
- },
9
- fixable: "code",
10
- schema: [], // no options
11
- };
12
-
13
- exports.create = function (context) {
14
- const sourceCode = context.getSourceCode();
15
- const sourceText = sourceCode.getText();
16
-
17
- return {
18
- IfStatement(node) {
19
- if (node.parent.type !== "IfStatement") {
20
- if (node.consequent.type != "BlockStatement") {
21
- // console.log(node);
22
- if (
23
- sourceText.charCodeAt(
24
- sourceCode.getTokenBefore(node.consequent).end,
25
- ) == 10
26
- ) {
27
- context.report({
28
- node: node,
29
- message: "Newline after if with no curly",
30
- });
31
- }
32
- }
33
- }
34
- },
35
- };
36
- };