Skip to content

Commit a1af638

Browse files
committed
Update code style and dependencies
## Summary - Update URLs in .editorconfig and .jshintrc files - Add new rules to .eslintrc file for code style consistency - Remove .jshintrc file - Update node.js versions in .travis.yml file ## Details The URLs in the `.editorconfig` and `.jshintrc` files were updated to use HTTPS instead of HTTP. In addition, the `.eslintrc` file was updated with new rules for code style consistency, including requiring `let` or `const` instead of `var`, enforcing spacing before blocks and functions, requiring parens in arrow function arguments, using template literals instead of string concatenation, and more. The `.jshintrc` file was removed as it is no longer needed. Finally, the node.js versions in the `.travis.yml` file were updated to include newer versions. ## Statistics - 5 files changed, 1 deleted - 23 insertions(+), 141 deletions(-) No dependency updates found.
1 parent 63d145c commit a1af638

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+987
-989
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# throughout this package, the Sails framework, and the Node-Machine project.
77
#
88
# To review what each of these options mean, see:
9-
# http://editorconfig.org/
9+
# https://editorconfig.org/
1010
root = true
1111

1212
[*]

.eslintrc

Lines changed: 139 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,23 @@
1010
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1111
// For more information about any of the rules below, check out the relevant
1212
// reference page on eslint.org. For example, to get details on "no-sequences",
13-
// you would visit `http://eslint.org/docs/rules/no-sequences`. If you're unsure
13+
// you would visit `https://eslint.org/docs/rules/no-sequences`. If you're unsure
1414
// or could use some advice, come by https://sailsjs.com/support.
1515
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1616

1717
"env": {
18-
"node": true
18+
"node": true,
19+
"es2021": true
1920
},
2021

2122
"parserOptions": {
22-
"ecmaVersion": 5
23-
// ^^This can be changed to `8` if this package doesn't need to support <= Node v6.
23+
"ecmaVersion": "latest"
2424
},
2525

26+
"plugins": [
27+
"eslint-comments"
28+
],
29+
2630
"globals": {
2731
"Promise": true
2832
// ^^Available since Node v4
@@ -46,6 +50,137 @@
4650
"ObjectExpression": 1,
4751
"ignoredNodes": ["ConditionalExpression"]
4852
}],
53+
// require let or const instead of var
54+
"no-var": "error",
55+
"no-whitespace-before-property": [
56+
"error"
57+
],
58+
"space-before-blocks": [
59+
"error"
60+
],
61+
"space-before-function-paren": [
62+
"error",
63+
{
64+
"anonymous": "always",
65+
"named": "never"
66+
}
67+
],
68+
"space-in-parens": [
69+
"error"
70+
],
71+
"space-infix-ops": [
72+
"error"
73+
],
74+
"space-unary-ops": [
75+
"error"
76+
],
77+
"spaced-comment": [
78+
"error",
79+
"always",
80+
{
81+
"line": {
82+
"markers": [
83+
"/"
84+
],
85+
"exceptions": [
86+
"-",
87+
"+"
88+
]
89+
},
90+
"block": {
91+
"markers": [
92+
"!"
93+
],
94+
"exceptions": [
95+
"*"
96+
],
97+
"balanced": true
98+
}
99+
}
100+
],
101+
"arrow-body-style": [
102+
"error",
103+
"as-needed",
104+
{
105+
"requireReturnForObjectLiteral": false
106+
}
107+
],
108+
// require parens in arrow function arguments
109+
// https://eslint.org/docs/rules/arrow-parens
110+
"arrow-parens": [
111+
"error",
112+
"as-needed",
113+
{
114+
"requireForBlockBody": true
115+
}
116+
],
117+
// require space before/after arrow function"s arrow
118+
// https://eslint.org/docs/rules/arrow-spacing
119+
"arrow-spacing": [
120+
"error",
121+
{
122+
"before": true,
123+
"after": true
124+
}
125+
],
126+
// Allow "confusing arrows" since, well, we don't confuse them
127+
// https://eslint.org/docs/rules/no-confusing-arrow
128+
"no-confusing-arrow": "off",
129+
// disallow modifying variables that are declared using const
130+
"no-const-assign": "error",
131+
// require method and property shorthand syntax for object literals
132+
// https://eslint.org/docs/rules/object-shorthand
133+
"object-shorthand": [
134+
"error",
135+
"always",
136+
{
137+
"ignoreConstructors": false,
138+
"avoidQuotes": true
139+
}
140+
],
141+
// suggest using arrow functions as callbacks
142+
"prefer-arrow-callback": [
143+
"error",
144+
{
145+
"allowNamedFunctions": false,
146+
"allowUnboundThis": true
147+
}
148+
],
149+
// suggest using of const declaration for variables that are never modified after declared
150+
"prefer-const": [
151+
"error",
152+
{
153+
"destructuring": "any",
154+
"ignoreReadBeforeAssign": true
155+
}
156+
],
157+
// disallow parseInt() in favor of binary, octal, and hexadecimal literals
158+
// https://eslint.org/docs/rules/prefer-numeric-literals
159+
"prefer-numeric-literals": "error",
160+
// suggest using Reflect methods where applicable
161+
// https://eslint.org/docs/rules/prefer-reflect
162+
"prefer-reflect": "off",
163+
// use rest parameters instead of arguments
164+
// https://eslint.org/docs/rules/prefer-rest-params
165+
"prefer-rest-params": "error",
166+
// suggest using the spread operator instead of .apply()
167+
// https://eslint.org/docs/rules/prefer-spread
168+
"prefer-spread": "error",
169+
// suggest using template literals instead of string concatenation
170+
// https://eslint.org/docs/rules/prefer-template
171+
"prefer-template": "error",
172+
// disallow generator functions that do not have yield
173+
// https://eslint.org/docs/rules/require-yield
174+
"require-yield": "error",
175+
// enforce spacing between object rest-spread
176+
// https://eslint.org/docs/rules/rest-spread-spacing
177+
"rest-spread-spacing": [
178+
"error",
179+
"never"
180+
],
181+
// enforce usage of spacing in template strings
182+
// https://eslint.org/docs/rules/template-curly-spacing
183+
"template-curly-spacing": "error",
49184
"linebreak-style": ["error", "unix"],
50185
"no-dupe-keys": ["error"],
51186
"no-duplicate-case": ["error"],

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ node_modules
1818
.tmp
1919
npm-debug.log
2020
package-lock.json
21+
package-lock.*
2122
.waterline
2223
.node_history
2324

.jshintrc

Lines changed: 0 additions & 134 deletions
This file was deleted.

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ dist: xenial
1414
language: node_js
1515

1616
node_js:
17-
- "12"
18-
- "14"
1917
- "16"
18+
- "18"
19+
- "19"
20+
- "20"
2021

2122
env:
2223
global:

0 commit comments

Comments
 (0)