summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerghei Iakovlev <egrep@protonmail.ch>2022-07-03 00:44:16 +0200
committerSerghei Iakovlev <egrep@protonmail.ch>2022-07-03 00:44:16 +0200
commit6da24c4be86ecb94d68e2fb1de36fff98c741de7 (patch)
tree8fafb3dc754aac9286afce7715e33def0f24c849
parent4b7517569083ba3c35f00dd5e41af585c0d1f857 (diff)
downloadgohugo-theme-ed-6da24c4be86ecb94d68e2fb1de36fff98c741de7.tar.gz
Setup eslint
-rw-r--r--.editorconfig2
-rw-r--r--.eslintrc69
2 files changed, 65 insertions, 6 deletions
diff --git a/.editorconfig b/.editorconfig
index 04255df..0ec9ed4 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,7 +12,7 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
-[*.{svg,css,scss,json,webmanifest,yaml,yml,toml,md,babelrc,eslintrc,postcssrc,stylelintrc,ecrc,gitattributes}]
+[*.{svg,css,scss,js,json,webmanifest,yaml,yml,toml,md,babelrc,eslintrc,postcssrc,stylelintrc,ecrc,gitattributes}]
indent_size = 2
[layouts/**.{svg}]
diff --git a/.eslintrc b/.eslintrc
index c091af7..f6f5a14 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -1,9 +1,68 @@
{
- "extends": "airbnb-base/legacy",
+ "extends": "eslint:recommended",
+
+ "parserOptions": {
+ "ecmaVersion": 2017
+ },
+
+ "env": {
+ "browser": true,
+ "es6": true,
+ "jquery": true
+ },
+
"rules": {
- "indent": [2, "tab"],
- "no-tabs": 0,
- "no-unused-vars": 0,
- "no-shadow-restricted-names": 0
+ //
+ // Possible Errors
+ //
+ // The following rules point out areas where you might have made mistakes.
+ //
+ "comma-dangle": 2, // disallow or enforce trailing commas
+ "no-console": 1, // disallow use of console (off by default in the node environment)
+ "no-debugger": 2, // disallow use of debugger
+ "no-empty": 2, // disallow empty statements
+ "no-extra-semi": 2, // disallow unnecessary semicolons
+
+ //
+ // Best Practices
+ //
+ // These are rules designed to prevent you from making mistakes.
+ // They either prescribe a better way of doing something or help you avoid footguns.
+ //
+ "eqeqeq": 2, // require the use of === and !==
+ "no-alert": 2, // disallow the use of alert, confirm, and prompt
+ "no-eval": 2, // disallow use of eval()
+ "no-multi-spaces": 2, // disallow use of multiple spaces
+ "no-redeclare": 2, // disallow declaring the same variable more then once
+
+ //
+ // Strict Mode
+ //
+ // These rules relate to using strict mode.
+ //
+ "strict": 0, // controls location of Use Strict Directives
+
+ //
+ // Stylistic Issues
+ //
+ // These rules are purely matters of style and are quite subjective.
+ //
+ "indent": [1, 2], // this option sets a specific tab width for your code (off by default)
+ "brace-style": 1, // enforce one true brace style (off by default)
+ "camelcase": 1, // require camel case names
+ "comma-spacing": [1, {"before": false, "after": true}], // enforce spacing before and after comma
+ "comma-style": [1, "last"], // enforce one true comma style (off by default)
+ "eol-last": 1, // enforce newline at the end of file, with no multiple empty lines
+ "quotes": [1, "single"], // specify whether double or single quotes should be used
+ "semi": [1, "always"], // require or disallow use of semicolons instead of ASI
+ "semi-spacing": [1, {"before": false, "after": true}], // enforce spacing before and after semicolons
+ "sort-vars": 0, // sort variables within the same declaration block (off by default)
+
+ //
+ // ECMAScript 6
+ //
+ // These rules are only relevant to ES6 environments and are off by default.
+ //
+ "no-var": 2 // require let or const instead of var (off by default)
}
}