Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2017-12-16 14:44:17 +0300
committerXhmikosR <xhmikosr@gmail.com>2018-01-11 19:48:46 +0300
commit6d336502c7e26c4cc5b35f1d7a19c067b774cb1f (patch)
tree249843876c99ceda24f3a1a65006a5753811d4e9
parent92cc0aba7be08add9833e1303088928363c3c199 (diff)
Clean up and tweak ESLint rules.
Also, refactor ESLint and stylelint config files; now everything will work from our root dir.
-rw-r--r--.eslintignore6
-rw-r--r--.eslintrc.json (renamed from js/.eslintrc.json)25
-rw-r--r--.stylelintignore4
-rw-r--r--.stylelintrc (renamed from build/.stylelintrc)0
-rw-r--r--assets/js/.eslintrc.json26
-rw-r--r--assets/js/src/ie-emulation-modes-warning.js1
-rw-r--r--build/.eslintrc.json20
-rw-r--r--docs/4.0/examples/.eslintrc.json11
-rw-r--r--docs/4.0/examples/.stylelintrc2
-rw-r--r--js/tests/karma.conf.js3
-rw-r--r--js/tests/unit/.eslintrc.json (renamed from js/tests/.eslintrc.json)17
-rw-r--r--package.json8
12 files changed, 84 insertions, 39 deletions
diff --git a/.eslintignore b/.eslintignore
index 8e0f5225cf..e1d5490eef 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,5 @@
**/*.min.js
-**/vendor/*
-**/dist/*
+**/dist/
+**/vendor/
+/_gh_pages/
+/package.js
diff --git a/js/.eslintrc.json b/.eslintrc.json
index fc5f6a4916..8cfaeea153 100644
--- a/js/.eslintrc.json
+++ b/.eslintrc.json
@@ -7,10 +7,6 @@
},
"extends": "eslint:recommended",
"plugins": ["compat"],
- "parserOptions": {
- "ecmaVersion": 8,
- "sourceType": "module"
- },
"rules": {
// Possible Errors
"no-await-in-loop": "error",
@@ -85,7 +81,7 @@
"no-unused-expressions": "error",
"no-useless-call": "error",
"no-useless-concat": "error",
- "no-useless-return": "off",
+ "no-useless-return": "error",
"no-void": "error",
"no-warning-comments": "off",
"no-with": "error",
@@ -141,13 +137,12 @@
"id-blacklist": "error",
"id-length": "off",
"id-match": "error",
- "indent": "off",
- "indent-legacy": ["error", 2, { "SwitchCase": 1 }],
+ "indent": ["error", 2, { "SwitchCase": 1 }],
"jsx-quotes": "error",
"key-spacing": "off",
"keyword-spacing": "error",
- "line-comment-position": "off",
"linebreak-style": ["error", "unix"],
+ "line-comment-position": "off",
"lines-around-comment": "off",
"lines-around-directive": "error",
"max-depth": ["error", 10],
@@ -159,10 +154,9 @@
"max-statements-per-line": "error",
"multiline-ternary": "off",
"new-cap": ["error", { "capIsNewExceptionPattern": "$.*" }],
- "new-parens": "error",
"newline-after-var": "off",
- "newline-before-return": "off",
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 5 }],
+ "new-parens": "error",
"no-array-constructor": "error",
"no-bitwise": "error",
"no-continue": "off",
@@ -171,6 +165,7 @@
"no-mixed-operators": "off",
"no-multi-assign": "error",
"no-multiple-empty-lines": "error",
+ "nonblock-statement-body-position": "error",
"no-negated-condition": "off",
"no-nested-ternary": "error",
"no-new-object": "error",
@@ -182,15 +177,15 @@
"no-underscore-dangle": "off",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
- "nonblock-statement-body-position": "error",
"object-curly-newline": ["error", { "minProperties": 1 }],
"object-curly-spacing": ["error", "always"],
"object-property-newline": "error",
"one-var": ["error", "never"],
"one-var-declaration-per-line": "error",
"operator-assignment": "error",
- "operator-linebreak": "off",
- "padded-blocks": "off",
+ "operator-linebreak": "error",
+ "padded-blocks": ["error", "never"],
+ "padding-line-between-statements": "off",
"quote-props": ["error", "as-needed"],
"quotes": ["error", "single"],
"require-jsdoc": "off",
@@ -200,8 +195,8 @@
"sort-vars": "error",
"space-before-blocks": "error",
"space-before-function-paren": ["error", {
- "anonymous": "always",
- "named": "never"
+ "anonymous": "always",
+ "named": "never"
}],
"space-in-parens": "error",
"space-infix-ops": "error",
diff --git a/.stylelintignore b/.stylelintignore
new file mode 100644
index 0000000000..7bc488e5f8
--- /dev/null
+++ b/.stylelintignore
@@ -0,0 +1,4 @@
+**/*.min.css
+**/dist/
+**/vendor/
+/_gh_pages/
diff --git a/build/.stylelintrc b/.stylelintrc
index 4a47533189..4a47533189 100644
--- a/build/.stylelintrc
+++ b/.stylelintrc
diff --git a/assets/js/.eslintrc.json b/assets/js/.eslintrc.json
new file mode 100644
index 0000000000..7ea25a91ba
--- /dev/null
+++ b/assets/js/.eslintrc.json
@@ -0,0 +1,26 @@
+{
+ "env": {
+ "es6": false,
+ "jquery": true
+ },
+ "parserOptions": {
+ "ecmaVersion": 5,
+ "sourceType": "script"
+ },
+ "extends": "../../.eslintrc.json",
+ "rules": {
+ // Best Practices
+ "no-magic-numbers": "off",
+ "vars-on-top": "off",
+
+ // Stylistic Issues
+ "spaced-comment": "off",
+
+ // ECMAScript 6
+ "no-var": "off",
+ "object-shorthand": "off",
+ "prefer-arrow-callback": "off",
+ "prefer-template": "off",
+ "prefer-rest-params": "off"
+ }
+}
diff --git a/assets/js/src/ie-emulation-modes-warning.js b/assets/js/src/ie-emulation-modes-warning.js
index c8984cc35f..ca2ae1222b 100644
--- a/assets/js/src/ie-emulation-modes-warning.js
+++ b/assets/js/src/ie-emulation-modes-warning.js
@@ -41,6 +41,7 @@
var nonEmulated = actualNonEmulatedIEMajorVersion()
if (emulated !== nonEmulated) {
+ // eslint-disable-next-line no-alert
window.alert('WARNING: You appear to be using IE' + nonEmulated + ' in IE' + emulated + ' emulation mode.\nIE emulation modes can behave significantly differently from ACTUAL older versions of IE.\nPLEASE DON\'T FILE BOOTSTRAP BUGS based on testing in IE emulation modes!')
}
}())
diff --git a/build/.eslintrc.json b/build/.eslintrc.json
new file mode 100644
index 0000000000..76e7f37b63
--- /dev/null
+++ b/build/.eslintrc.json
@@ -0,0 +1,20 @@
+{
+ "env": {
+ "browser": false,
+ "node": true
+ },
+ "parserOptions": {
+ "sourceType": "script"
+ },
+ "extends": "../.eslintrc.json",
+ "rules": {
+ "consistent-return": "off",
+ "func-style": "off",
+ "no-console": "off",
+ "no-magic-numbers": "off",
+ "no-process-env": "off",
+ "no-process-exit": "off",
+ "no-sync": "off",
+ "spaced-comment": "off"
+ }
+}
diff --git a/docs/4.0/examples/.eslintrc.json b/docs/4.0/examples/.eslintrc.json
new file mode 100644
index 0000000000..f04fd6ae13
--- /dev/null
+++ b/docs/4.0/examples/.eslintrc.json
@@ -0,0 +1,11 @@
+{
+ "env": {
+ "es6": false,
+ "jquery": true
+ },
+ "parserOptions": {
+ "ecmaVersion": 5,
+ "sourceType": "script"
+ },
+ "extends": "../../../js/tests/unit/.eslintrc.json"
+}
diff --git a/docs/4.0/examples/.stylelintrc b/docs/4.0/examples/.stylelintrc
index 44cf7c0e0f..6a77dcedb6 100644
--- a/docs/4.0/examples/.stylelintrc
+++ b/docs/4.0/examples/.stylelintrc
@@ -1,5 +1,5 @@
{
- "extends": "../../../build/.stylelintrc",
+ "extends": "../../../.stylelintrc",
"rules": {
"at-rule-no-vendor-prefix": null,
"comment-empty-line-before": null,
diff --git a/js/tests/karma.conf.js b/js/tests/karma.conf.js
index da4e1ccb19..57d44718da 100644
--- a/js/tests/karma.conf.js
+++ b/js/tests/karma.conf.js
@@ -1,6 +1,5 @@
/* eslint-env node */
-
-'use strict'
+/* eslint no-process-env: 0 */
module.exports = (config) => {
const jqueryFile = process.env.USE_OLD_JQUERY ? 'js/tests/vendor/jquery-1.9.1.min.js' : 'assets/js/vendor/jquery-slim.min.js'
diff --git a/js/tests/.eslintrc.json b/js/tests/unit/.eslintrc.json
index 1452045e21..9e1c60a6cd 100644
--- a/js/tests/.eslintrc.json
+++ b/js/tests/unit/.eslintrc.json
@@ -11,29 +11,16 @@
"ecmaVersion": 5,
"sourceType": "script"
},
- "extends": "../.eslintrc.json",
+ "extends": "../../../.eslintrc.json",
"rules": {
+ "no-console": "off",
// Best Practices
"consistent-return": "off",
- "no-alert": "off",
- "no-console": "off",
- "no-empty-function": "off",
- "no-extend-native": "off",
"no-magic-numbers": "off",
"vars-on-top": "off",
- // NodeJS and CommonJS
- "global-require": "off",
- "no-process-env": "off",
- "no-process-exit": "off",
- "no-sync": "off",
-
// Stylistic Issues
- "brace-style": "off",
"func-style": "off",
- "max-statements-per-line": "off",
- "object-curly-newline": "off",
- "object-property-newline": "off",
"spaced-comment": "off",
// ECMAScript 6
diff --git a/package.json b/package.json
index 95b3e07cdb..4335f2778b 100644
--- a/package.json
+++ b/package.json
@@ -23,8 +23,8 @@
"css-docs": "npm-run-all --parallel css-lint-docs css-compile-docs --sequential css-prefix-docs css-minify-docs",
"css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/bootstrap.scss dist/css/bootstrap.css && node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/bootstrap-grid.scss dist/css/bootstrap-grid.css && node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 scss/bootstrap-reboot.scss dist/css/bootstrap-reboot.css",
"css-compile-docs": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 assets/scss/docs.scss assets/css/docs.min.css",
- "css-lint": "stylelint --config build/.stylelintrc --syntax scss \"scss/**/*.scss\"",
- "css-lint-docs": "stylelint --config build/.stylelintrc --syntax scss \"assets/scss/*.scss\" && stylelint --config docs/4.0/examples/.stylelintrc \"docs/**/*.css\"",
+ "css-lint": "stylelint --syntax scss \"scss/**/*.scss\"",
+ "css-lint-docs": "stylelint --syntax scss \"assets/scss/*.scss\" && stylelint \"docs/**/*.css\"",
"css-lint-vars": "node build/lint-vars.js scss/ assets/scss/",
"css-prefix": "postcss --config build/postcss.config.js --replace \"dist/css/*.css\" \"!dist/css/*.min.css\"",
"css-prefix-docs": "postcss --config build/postcss.config.js --replace \"assets/css/docs.min.css\" \"docs/**/*.css\"",
@@ -33,8 +33,8 @@
"js": "npm-run-all js-lint* js-compile js-minify",
"js-main": "npm-run-all js-lint js-compile js-minify",
"js-docs": "npm-run-all js-lint-docs js-minify-docs",
- "js-lint": "eslint js/ && eslint --config js/tests/.eslintrc.json --env node build/",
- "js-lint-docs": "eslint --config js/tests/.eslintrc.json assets/js/ docs/ sw.js",
+ "js-lint": "eslint js/ build/",
+ "js-lint-docs": "eslint assets/js/ docs/ sw.js",
"js-compile": "npm-run-all --parallel js-compile-*",
"js-compile-standalone": "rollup --environment BUNDLE:false --config build/rollup.config.js --sourcemap",
"js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.js --sourcemap",