Skip to content

Commit 61efd72

Browse files
committed
refactor: Move over from Plain JavaScript to ES6
1 parent a2f0409 commit 61efd72

27 files changed

+2266
-1294
lines changed

.babelrc.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/env',
5+
{
6+
loose: true,
7+
modules: false,
8+
exclude: ['transform-typeof-symbol']
9+
}
10+
]
11+
],
12+
plugins: [
13+
process.env.PLUGINS && 'transform-es2015-modules-strip',
14+
['@babel/proposal-object-rest-spread', {loose: true, useBuiltIns: true}]
15+
].filter(Boolean),
16+
env: {
17+
test: {
18+
plugins: [ 'istanbul' ]
19+
}
20+
}
21+
};

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
**/*.min.js
2+
**/dist/

.eslintrc.json

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
{
2+
"root": true,
3+
"parser": "babel-eslint",
4+
"env": {
5+
"browser": true,
6+
"es6": true
7+
},
8+
"extends": "eslint:recommended",
9+
"plugins": ["compat"],
10+
"rules": {
11+
// Possible Errors
12+
"no-await-in-loop": "error",
13+
"no-extra-parens": "error",
14+
"no-prototype-builtins": "error",
15+
"no-template-curly-in-string": "error",
16+
"compat/compat": "error",
17+
"valid-jsdoc": "error",
18+
19+
// Best Practices
20+
"accessor-pairs": "error",
21+
"array-callback-return": "error",
22+
"block-scoped-var": "error",
23+
"class-methods-use-this": "off",
24+
"complexity": "error",
25+
"consistent-return": "error",
26+
"curly": "error",
27+
"default-case": "error",
28+
"dot-location": ["error", "property"],
29+
"dot-notation": "error",
30+
"eqeqeq": "error",
31+
"guard-for-in": "error",
32+
"no-alert": "error",
33+
"no-caller": "error",
34+
"no-div-regex": "error",
35+
"no-else-return": "error",
36+
"no-empty-function": "error",
37+
"no-eq-null": "error",
38+
"no-eval": "error",
39+
"no-extend-native": "error",
40+
"no-extra-bind": "error",
41+
"no-extra-label": "error",
42+
"no-floating-decimal": "error",
43+
"no-implicit-coercion": "error",
44+
"no-implicit-globals": "error",
45+
"no-implied-eval": "error",
46+
"no-invalid-this": "off",
47+
"no-iterator": "error",
48+
"no-labels": "error",
49+
"no-lone-blocks": "error",
50+
"no-loop-func": "error",
51+
"no-magic-numbers": ["error", {
52+
"ignore": [-1, 0, 1],
53+
"ignoreArrayIndexes": true
54+
}
55+
],
56+
"no-multi-spaces": ["error", {
57+
"ignoreEOLComments": true,
58+
"exceptions": {
59+
"AssignmentExpression": true,
60+
"ArrowFunctionExpression": true,
61+
"CallExpression": true,
62+
"VariableDeclarator": true
63+
}
64+
}
65+
],
66+
"no-multi-str": "error",
67+
"no-new": "error",
68+
"no-new-func": "error",
69+
"no-new-wrappers": "error",
70+
"no-octal-escape": "error",
71+
"no-param-reassign": "off",
72+
"no-proto": "error",
73+
"no-restricted-properties": "error",
74+
"no-return-assign": "error",
75+
"no-return-await": "error",
76+
"no-script-url": "error",
77+
"no-self-compare": "error",
78+
"no-sequences": "error",
79+
"no-throw-literal": "error",
80+
"no-unmodified-loop-condition": "error",
81+
"no-unused-expressions": "error",
82+
"no-useless-call": "error",
83+
"no-useless-concat": "error",
84+
"no-useless-return": "error",
85+
"no-void": "error",
86+
"no-warning-comments": "off",
87+
"no-with": "error",
88+
"prefer-promise-reject-errors": "error",
89+
"radix": "error",
90+
"require-await": "error",
91+
"vars-on-top": "error",
92+
"wrap-iife": "error",
93+
"yoda": "error",
94+
95+
// Strict Mode
96+
"strict": "error",
97+
98+
// Variables
99+
"init-declarations": "off",
100+
"no-catch-shadow": "error",
101+
"no-label-var": "error",
102+
"no-restricted-globals": "error",
103+
"no-shadow": "off",
104+
"no-shadow-restricted-names": "error",
105+
"no-undef-init": "error",
106+
"no-undefined": "error",
107+
"no-use-before-define": "off",
108+
109+
// Node.js and CommonJS
110+
"callback-return": "off",
111+
"global-require": "error",
112+
"handle-callback-err": "error",
113+
"no-mixed-requires": "error",
114+
"no-new-require": "error",
115+
"no-path-concat": "error",
116+
"no-process-env": "error",
117+
"no-process-exit": "error",
118+
"no-restricted-modules": "error",
119+
"no-sync": "error",
120+
121+
// Stylistic Issues
122+
"array-bracket-spacing": "error",
123+
"block-spacing": "error",
124+
"brace-style": "error",
125+
"camelcase": "error",
126+
"capitalized-comments": "off",
127+
"comma-dangle": "error",
128+
"comma-spacing": "error",
129+
"comma-style": "error",
130+
"computed-property-spacing": "error",
131+
"consistent-this": "error",
132+
"eol-last": "error",
133+
"func-call-spacing": "error",
134+
"func-name-matching": "error",
135+
"func-names": "off",
136+
"func-style": ["error", "declaration", { "allowArrowFunctions": true }],
137+
"id-blacklist": "error",
138+
"id-length": "off",
139+
"id-match": "error",
140+
"indent": ["error", 2, { "SwitchCase": 1 }],
141+
"jsx-quotes": "error",
142+
"key-spacing": "off",
143+
"keyword-spacing": "error",
144+
"linebreak-style": ["error", "unix"],
145+
"line-comment-position": "off",
146+
"lines-around-comment": "off",
147+
"lines-around-directive": "error",
148+
"max-depth": ["error", 10],
149+
"max-len": "off",
150+
"max-lines": "off",
151+
"max-nested-callbacks": "error",
152+
"max-params": "off",
153+
"max-statements": "off",
154+
"max-statements-per-line": "error",
155+
"multiline-ternary": "off",
156+
"new-cap": ["error", { "capIsNewExceptionPattern": "$.*" }],
157+
"newline-after-var": "off",
158+
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 5 }],
159+
"new-parens": "error",
160+
"no-array-constructor": "error",
161+
"no-bitwise": "error",
162+
"no-continue": "off",
163+
"no-inline-comments": "off",
164+
"no-lonely-if": "error",
165+
"no-mixed-operators": "off",
166+
"no-multi-assign": "error",
167+
"no-multiple-empty-lines": "error",
168+
"nonblock-statement-body-position": "error",
169+
"no-negated-condition": "off",
170+
"no-nested-ternary": "error",
171+
"no-new-object": "error",
172+
"no-plusplus": "off",
173+
"no-restricted-syntax": "error",
174+
"no-tabs": "error",
175+
"no-ternary": "off",
176+
"no-trailing-spaces": "error",
177+
"no-underscore-dangle": "off",
178+
"no-unneeded-ternary": "error",
179+
"no-whitespace-before-property": "error",
180+
"object-curly-newline": ["error", { "minProperties": 1 }],
181+
"object-curly-spacing": ["error", "always"],
182+
"object-property-newline": "error",
183+
"one-var": ["error", "never"],
184+
"one-var-declaration-per-line": "error",
185+
"operator-assignment": "error",
186+
"operator-linebreak": "error",
187+
"padded-blocks": ["error", "never"],
188+
"padding-line-between-statements": "off",
189+
"quote-props": ["error", "as-needed"],
190+
"quotes": ["error", "single"],
191+
"require-jsdoc": "off",
192+
"semi": ["error", "never"],
193+
"semi-spacing": "error",
194+
"sort-keys": "off",
195+
"sort-vars": "error",
196+
"space-before-blocks": "error",
197+
"space-before-function-paren": ["error", {
198+
"anonymous": "always",
199+
"named": "never"
200+
}],
201+
"space-in-parens": "error",
202+
"space-infix-ops": "error",
203+
"space-unary-ops": "error",
204+
"spaced-comment": "error",
205+
"template-tag-spacing": "error",
206+
"unicode-bom": "error",
207+
"wrap-regex": "off",
208+
209+
// ECMAScript 6
210+
"arrow-body-style": ["error", "as-needed"],
211+
"arrow-parens": "error",
212+
"arrow-spacing": "error",
213+
"generator-star-spacing": "error",
214+
"no-confusing-arrow": "error",
215+
"no-duplicate-imports": "error",
216+
"no-restricted-imports": "error",
217+
"no-useless-computed-key": "error",
218+
"no-useless-constructor": "error",
219+
"no-useless-rename": "error",
220+
"no-var": "error",
221+
"object-shorthand": "error",
222+
"prefer-arrow-callback": "error",
223+
"prefer-const": "error",
224+
"prefer-destructuring": "off",
225+
"prefer-numeric-literals": "error",
226+
"prefer-rest-params": "error",
227+
"prefer-spread": "error",
228+
"prefer-template": "error",
229+
"rest-spread-spacing": "error",
230+
"sort-imports": "error",
231+
"symbol-description": "error",
232+
"template-curly-spacing": "error",
233+
"yield-star-spacing": "error"
234+
}
235+
}

package.json

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "@coreui/free-bootstrap-admin-template",
3-
"version": "2.0.0-beta.0",
2+
"name": "@coreui/coreui-free-bootstrap-admin-template",
3+
"version": "2.0.0-beta.1",
44
"description": "Free Bootstrap Admin Template",
55
"keywords": [
66
"admin",
@@ -18,7 +18,7 @@
1818
],
1919
"homepage": "https://coreui.io",
2020
"bugs": {
21-
"url": "https://github.com/coreui/free-bootstrap-admin-template/issues",
21+
"url": "https://github.com/coreui/coreui-free-bootstrap-admin-template/issues",
2222
"email": "[email protected]"
2323
},
2424
"license": "MIT",
@@ -37,7 +37,7 @@
3737
"main": "src/index.html",
3838
"repository": {
3939
"type": "git",
40-
"url": "git+https://github.com/coreui/free-bootstrap-admin-template.git"
40+
"url": "git+https://github.com/coreui/coreui-free-bootstrap-admin-template.git"
4141
},
4242
"scripts": {
4343
"build": "npm-run-all build-clean build-copy build-vendors",
@@ -52,12 +52,17 @@
5252
"css-minify-vendors": "foreach -g \"src/vendors/css/**/*.css\" -i \"src/vendors/css/**/*.min.css\" -x \"cleancss --level 1 --source-map --source-map-inline-sources #{path} --output #{dir}/#{name}.min#{ext}\" --no-c",
5353
"css-prefix": "postcss --config build/postcss.config.js --replace \"src/css/*.css\" \"!src/css/*.min.css\"",
5454
"css-prefix-vendors": "postcss --config build/postcss.config.js --replace \"src/vendors/css/**/*.css\" \"!src/vendors/css/**/*.css\"",
55-
"localhost": "browser-sync start --server \"./src\" --serveStatic \"./\" --files \"./src/**/*, !./src/scss/**/*\"",
56-
"serve": "npm-run-all --parallel localhost watch-css",
57-
"watch-css": "nodemon --ignore dist/ -e scss -x \"npm run css\""
55+
"js": "npm-run-all --parallel js-compile* js-lint*",
56+
"js-compile": "cross-env PLUGINS=true babel src/js/src/ --out-dir src/js/ --source-maps",
57+
"js-lint": "eslint src/js/src",
58+
"localhost": "browser-sync start --server \"./src\" --serveStatic \"./\" --files \"!./src/js/src/**/*, ./src/**/*, !./src/scss/**/*\"",
59+
"release-version": "node build/change-version.js",
60+
"serve": "npm-run-all --parallel localhost watch-css watch-js",
61+
"watch-css": "nodemon --ignore dist/ -e scss -x \"npm run css\"",
62+
"watch-js": "nodemon --watch src/js/src/ -x \"npm run js\""
5863
},
5964
"dependencies": {
60-
"@coreui/coreui": "^2.0.0-beta.0",
65+
"@coreui/coreui": "^2.0.0-beta.1",
6166
"@coreui/plugin-chartjs-custom-tooltips": "0.0.1",
6267
"bootstrap": "4.0.0",
6368
"chart.js": "^2.7.2",
@@ -70,9 +75,18 @@
7075
"simple-line-icons": "2.4.1"
7176
},
7277
"devDependencies": {
78+
"@babel/cli": "^7.0.0-beta.42",
79+
"@babel/core": "^7.0.0-beta.42",
80+
"@babel/preset-env": "^7.0.0-beta.42",
81+
"autoprefixer": "^8.2.0",
82+
"babel-eslint": "^8.2.2",
83+
"babel-plugin-transform-es2015-modules-strip": "^0.1.1",
7384
"browser-sync": "2.23.6",
7485
"clean-css-cli": "^4.1.11",
7586
"copyfiles": "^2.0.0",
87+
"cross-env": "^5.1.4",
88+
"eslint": "^4.19.1",
89+
"eslint-plugin-compat": "^2.2.0",
7690
"foreach-cli": "^1.8.0",
7791
"node-sass": "^4.8.3",
7892
"nodemon": "^1.17.2",

0 commit comments

Comments
 (0)