diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..255b0f2f8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,5 @@ +{ + "extends": [ + "./lint/eslintrc-gjs.json" + ] +} diff --git a/lint/eslintrc-gjs.json b/lint/eslintrc-gjs.json new file mode 100644 index 000000000..74cadf263 --- /dev/null +++ b/lint/eslintrc-gjs.json @@ -0,0 +1,130 @@ +{ + "env": { + "es6": true + }, + "extends": "eslint:recommended", + "rules": { + "array-bracket-newline": [ + "error", + "consistent" + ], + "array-bracket-spacing": [ + "error", + "never" + ], + "arrow-spacing": "error", + "brace-style": "error", + "comma-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "indent": [ + "error", + 4, + { + "ignoredNodes": [ + "CallExpression[callee.object.name=GObject][callee.property.name=registerClass] > ClassExpression:first-child" + ], + "MemberExpression": "off" + } + ], + "key-spacing": [ + "error", + { + "beforeColon": false, + "afterColon": true + } + ], + "keyword-spacing": [ + "error", + { + "before": true, + "after": true + } + ], + "linebreak-style": [ + "error", + "unix" + ], + "no-empty": [ + "error", + { + "allowEmptyCatch": true + } + ], + "no-implicit-coercion": [ + "error", + { + "allow": ["!!"] + } + ], + "no-restricted-properties": [ + "error", + { + "object": "Lang", + "property": "bind", + "message": "Use arrow notation or Function.prototype.bind()" + }, + { + "object": "Lang", + "property": "Class", + "message": "Use ES6 classes" + } + ], + "nonblock-statement-body-position": [ + "error", + "below" + ], + "object-curly-newline": [ + "error", + { + "consistent": true + } + ], + "object-curly-spacing": "error", + "prefer-template": "error", + "quotes": [ + "error", + "single", + { + "avoidEscape": true + } + ], + "semi": [ + "error", + "always" + ], + "semi-spacing": [ + "error", + { + "before": false, + "after": true + } + ], + "space-before-blocks": "error", + "space-infix-ops": [ + "error", + { + "int32Hint": false + } + ] + }, + "globals": { + "ARGV": false, + "Debugger": false, + "GIRepositoryGType": false, + "imports": false, + "Intl": false, + "log": false, + "logError": false, + "print": false, + "printerr": false, + "window": false + }, + "parserOptions": { + "ecmaVersion": 2017 + } +}