Skip to content

Commit

Permalink
use mediawiki linter instead of my custom definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
NovemLinguae committed Mar 26, 2024
1 parent 841790b commit 03cbcb7
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 88 deletions.
102 changes: 14 additions & 88 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,94 +1,20 @@
{
"extends": [
"eslint:recommended",
"plugin:sonarjs/recommended",
"plugin:jsdoc/recommended"
"wikimedia/client/es6",
"wikimedia/jquery",
"wikimedia/mediawiki"
],
"root": true,
"env": {
"browser": true,
"jquery": true,
"es2022": true
},
"globals": {
"mw": "readonly",
"Map": "readonly"
"mw": "readonly"
},
"ignorePatterns": ["scripts/", "tests/", "lib/"],
"plugins": [
"lodash",
"sonarjs",
"unicorn",
"jsdoc"
],
"rules": {
"unicorn/no-abusive-eslint-disable": "error",
"no-constant-condition": 0,
"no-console": "warn",
"no-unreachable-loop": "error",
"block-scoped-var": "error",
"curly": ["error"],
"lodash/prefer-includes": "error",
"lodash/prefer-startswith": "error",
"no-caller": "error",
"no-implicit-coercion": ["error", { "boolean": false }],
"no-lone-blocks": "error",
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
"yoda": "error",
"block-spacing": "error",
"brace-style": ["error", "1tbs"],
"comma-spacing": ["error", { "before": false, "after": true }],
"func-call-spacing": ["error", "never"],
"indent": ["error", "tab", {
"outerIIFEBody": 0,
"SwitchCase": 1,
"ignoreComments": true
}],
"key-spacing": ["error", {"singleLine": {"beforeColon": false, "afterColon": true}}],
"keyword-spacing": ["error", { "after": true, "before": true}],
"no-array-constructor": "error",
"no-bitwise": "error",
"no-mixed-operators": "error",
"no-nested-ternary": "error",
"no-new-object": "error",
"no-unneeded-ternary": "error",
"no-useless-escape": 0,
"no-whitespace-before-property": "error",
"semi": ["error", "always"],
"space-before-blocks": "error",
"switch-colon-spacing": "error",
"no-restricted-syntax": [
"error",
{
"message": "Using .done() is not allowed. See https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Asynchronous_code",
"selector": "MemberExpression > Identifier[name=\"done\"]"
},
{
"message": "Using .fail() is not allowed. See https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Asynchronous_code",
"selector": "MemberExpression > Identifier[name=\"fail\"]"
}
],
"no-trailing-spaces": "error",
"space-infix-ops": "error",
"no-multiple-empty-lines": ["error", {"max": 1}],
"no-script-url": "error",
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param": 0,
"jsdoc/require-returns-description": 0,
"sonarjs/prefer-single-boolean-return": 0,
"sonarjs/prefer-immediate-return": 0
"parserOptions": {
"ecmaVersion": "latest"
},
"reportUnusedDisableDirectives": true,
"overrides": [
{
"files": [
"popups.js"
],
"parserOptions": {
"ecmaVersion": 5
}
}
]
}
"rules": {
"es-x/no-class-fields": 0,
"max-len": 0,
"es-x/no-async-functions": 0,
"es-x/no-array-prototype-includes": 0,
"no-jquery/variable-pattern": 0
}
}
94 changes: 94 additions & 0 deletions .eslintrc.json - generic
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
"extends": [
"eslint:recommended",
"plugin:sonarjs/recommended",
"plugin:jsdoc/recommended"
],
"root": true,
"env": {
"browser": true,
"jquery": true,
"es2022": true
},
"globals": {
"mw": "readonly",
"Map": "readonly"
},
"ignorePatterns": ["scripts/", "tests/", "lib/"],
"plugins": [
"lodash",
"sonarjs",
"unicorn",
"jsdoc"
],
"rules": {
"unicorn/no-abusive-eslint-disable": "error",
"no-constant-condition": 0,
"no-console": "warn",
"no-unreachable-loop": "error",
"block-scoped-var": "error",
"curly": ["error"],
"lodash/prefer-includes": "error",
"lodash/prefer-startswith": "error",
"no-caller": "error",
"no-implicit-coercion": ["error", { "boolean": false }],
"no-lone-blocks": "error",
"no-multi-spaces": ["error", { "ignoreEOLComments": true }],
"yoda": "error",
"block-spacing": "error",
"brace-style": ["error", "1tbs"],
"comma-spacing": ["error", { "before": false, "after": true }],
"func-call-spacing": ["error", "never"],
"indent": ["error", "tab", {
"outerIIFEBody": 0,
"SwitchCase": 1,
"ignoreComments": true
}],
"key-spacing": ["error", {"singleLine": {"beforeColon": false, "afterColon": true}}],
"keyword-spacing": ["error", { "after": true, "before": true}],
"no-array-constructor": "error",
"no-bitwise": "error",
"no-mixed-operators": "error",
"no-nested-ternary": "error",
"no-new-object": "error",
"no-unneeded-ternary": "error",
"no-useless-escape": 0,
"no-whitespace-before-property": "error",
"semi": ["error", "always"],
"space-before-blocks": "error",
"switch-colon-spacing": "error",
"no-restricted-syntax": [
"error",
{
"message": "Using .done() is not allowed. See https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Asynchronous_code",
"selector": "MemberExpression > Identifier[name=\"done\"]"
},
{
"message": "Using .fail() is not allowed. See https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Asynchronous_code",
"selector": "MemberExpression > Identifier[name=\"fail\"]"
}
],
"no-trailing-spaces": "error",
"space-infix-ops": "error",
"no-multiple-empty-lines": ["error", {"max": 1}],
"no-script-url": "error",
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param": 0,
"jsdoc/require-returns-description": 0,
"sonarjs/prefer-single-boolean-return": 0,
"sonarjs/prefer-immediate-return": 0
},
"reportUnusedDisableDirectives": true,
"overrides": [
{
"files": [
"popups.js"
],
"parserOptions": {
"ecmaVersion": 5
}
}
]
}

0 comments on commit 03cbcb7

Please sign in to comment.