@haraka/eslint-config 1.1.1 → 1.1.3
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 +9 -0
- package/README.md +16 -8
- package/index.js +5 -2
- package/package.json +11 -12
- package/rules/no-newline-no-curly-if.js +0 -36
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
4
4
|
|
|
5
5
|
### Unreleased
|
|
6
6
|
|
|
7
|
+
### [1.1.3] - 2024-04-07
|
|
8
|
+
|
|
9
|
+
- add env.es2020=true
|
|
10
|
+
- add parserOptions.ecmaVersion = latest
|
|
11
|
+
|
|
7
12
|
#### [1.1.1] - 2024-04-06
|
|
8
13
|
|
|
14
|
+
- remove rule no-newline-no-curly-if
|
|
9
15
|
- remove haraka:recommended
|
|
10
16
|
- remove rules included in eslint:recommended
|
|
11
17
|
|
|
@@ -91,3 +97,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
|
|
|
91
97
|
[1.0.11]: https://github.com/haraka/haraka-eslint/releases/tag/1.0.11
|
|
92
98
|
[1.0.15]: https://github.com/haraka/haraka-eslint/releases/tag/1.0.15
|
|
93
99
|
[1.0.16]: https://github.com/haraka/haraka-eslint/releases/tag/v1.0.16
|
|
100
|
+
[1.1.0]: https://github.com/haraka/haraka-eslint/releases/tag/v1.1.0
|
|
101
|
+
[1.1.1]: https://github.com/haraka/haraka-eslint/releases/tag/v1.1.1
|
|
102
|
+
[1.1.3]: https://github.com/haraka/haraka-eslint/releases/tag/v1.1.3
|
package/README.md
CHANGED
|
@@ -7,24 +7,32 @@
|
|
|
7
7
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
|
-
In your Haraka
|
|
10
|
+
In your Haraka module:
|
|
11
11
|
|
|
12
|
-
1.
|
|
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
|
-
|
|
16
|
-
|
|
19
|
+
cat <<EOLINT > .eslintrc.yaml
|
|
20
|
+
env:
|
|
21
|
+
node: true
|
|
22
|
+
es6: true
|
|
23
|
+
es2022: true
|
|
24
|
+
extends: "@haraka"
|
|
17
25
|
EOLINT
|
|
18
26
|
```
|
|
19
27
|
|
|
20
|
-
|
|
28
|
+
3. Add to the "scripts" section of `package.json`:
|
|
21
29
|
|
|
22
30
|
```json
|
|
23
31
|
"lint": "npx eslint@8 *.js test"
|
|
24
32
|
"lint:fix": "npx eslint@8 --fix *.js test"
|
|
25
33
|
```
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
4. Within your CI workflow:
|
|
28
36
|
|
|
29
37
|
`npm run lint`
|
|
30
38
|
|
|
@@ -34,11 +42,11 @@ To check your project against lint rules:
|
|
|
34
42
|
|
|
35
43
|
`npm run lint`
|
|
36
44
|
|
|
37
|
-
Step #
|
|
45
|
+
Step #4 above does this automatically when CI tests are set up.
|
|
38
46
|
|
|
39
47
|
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
48
|
|
|
41
|
-
|
|
49
|
+
Custom rules can be added to the .eslintrc file.
|
|
42
50
|
|
|
43
51
|
<!-- leave these buried at the bottom of the document -->
|
|
44
52
|
|
package/index.js
CHANGED
|
@@ -5,9 +5,10 @@ module.exports = {
|
|
|
5
5
|
node: true,
|
|
6
6
|
es6: true,
|
|
7
7
|
mocha: true,
|
|
8
|
+
es2022: true,
|
|
8
9
|
},
|
|
9
10
|
root: true,
|
|
10
|
-
extends: "eslint:recommended",
|
|
11
|
+
extends: ["eslint:recommended"],
|
|
11
12
|
globals: {
|
|
12
13
|
OK: true,
|
|
13
14
|
CONT: true,
|
|
@@ -16,9 +17,11 @@ module.exports = {
|
|
|
16
17
|
DENYDISCONNECT: true,
|
|
17
18
|
DENYSOFTDISCONNECT: true,
|
|
18
19
|
},
|
|
20
|
+
parserOptions: {
|
|
21
|
+
ecmaVersion: "latest",
|
|
22
|
+
},
|
|
19
23
|
rules: {
|
|
20
24
|
// 0 = off // 1 = warn // 2 = error
|
|
21
|
-
"no-newline-no-curly-if": require("./rules/no-newline-no-curly-if"),
|
|
22
25
|
"no-empty": ["error", { allowEmptyCatch: true }],
|
|
23
26
|
"no-undef": "warn",
|
|
24
27
|
"no-console": "off",
|
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haraka/eslint-config",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "eslint config for Haraka projects",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"haraka",
|
|
7
|
+
"lint",
|
|
6
8
|
"eslint",
|
|
7
|
-
"eslintconfig"
|
|
9
|
+
"eslintconfig",
|
|
10
|
+
"test"
|
|
8
11
|
],
|
|
9
12
|
"main": "index.js",
|
|
10
13
|
"files": [
|
|
@@ -13,22 +16,18 @@
|
|
|
13
16
|
],
|
|
14
17
|
"scripts": {
|
|
15
18
|
"format": "npm run prettier:fix && npm run lint:fix",
|
|
16
|
-
"lint": "npx eslint
|
|
17
|
-
"lint:fix": "
|
|
19
|
+
"lint": "npx eslint@^8 *.js",
|
|
20
|
+
"lint:fix": "npx eslint@^8 *.js --fix",
|
|
18
21
|
"prettier": "npx prettier . --check",
|
|
19
|
-
"prettier:fix": "npx prettier . --write",
|
|
20
|
-
"test": "node index.js"
|
|
22
|
+
"prettier:fix": "npx prettier . --write --log-level=warn",
|
|
23
|
+
"test": "node index.js",
|
|
24
|
+
"versions": "npx @msimerson/dependency-version-checker check",
|
|
25
|
+
"versions:fix": "npx @msimerson/dependency-version-checker update"
|
|
21
26
|
},
|
|
22
27
|
"repository": {
|
|
23
28
|
"type": "git",
|
|
24
29
|
"url": "git+https://github.com/haraka/haraka-eslint.git"
|
|
25
30
|
},
|
|
26
|
-
"keywords": [
|
|
27
|
-
"haraka",
|
|
28
|
-
"lint",
|
|
29
|
-
"eslint",
|
|
30
|
-
"test"
|
|
31
|
-
],
|
|
32
31
|
"author": "Matt Simerson <matt@tnpi.net>",
|
|
33
32
|
"license": "MIT",
|
|
34
33
|
"bugs": {
|
|
@@ -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
|
-
};
|