- Linting (ESLint): Avoid JSON quoting

This commit is contained in:
Brett Zamir
2018-11-16 15:15:17 +08:00
parent c5fd7678fb
commit 18bbfe8c15

View File

@@ -1,57 +1,57 @@
module.exports = { module.exports = {
"extends": [ extends: [
"ash-nazg/sauron-node", "ash-nazg/sauron-node",
"plugin:qunit/recommended", "plugin:testcafe/recommended" "plugin:qunit/recommended", "plugin:testcafe/recommended"
], ],
"parserOptions": { parserOptions: {
"sourceType": "module" sourceType: "module"
}, },
// Need to make explicit here for processing by jsdoc/check-examples // Need to make explicit here for processing by jsdoc/check-examples
"plugins": ["qunit"], plugins: ["qunit"],
"env": { env: {
"browser": true browser: true
}, },
"settings": { settings: {
"polyfills": ["url", "promises", "fetch", "queryselector"], polyfills: ["url", "promises", "fetch", "queryselector"],
"jsdoc": { jsdoc: {
"additionalTagNames": { additionalTagNames: {
// In case we need to extend // In case we need to extend
"customTags": [] customTags: []
}, },
"tagNamePreference": { tagNamePreference: {
"arg": "param", arg: "param",
"return": "returns" return: "returns"
}, },
"allowOverrideWithoutParam": true, allowOverrideWithoutParam: true,
"allowImplementsWithoutParam": true, allowImplementsWithoutParam: true,
"allowAugmentsExtendsWithoutParam": true, allowAugmentsExtendsWithoutParam: true,
// For `jsdoc/check-examples` in `ash-nazg` // For `jsdoc/check-examples` in `ash-nazg`
"matchingFileName": "dummy.md", matchingFileName: "dummy.md",
"rejectExampleCodeRegex": "^`", rejectExampleCodeRegex: "^`",
} }
}, },
"overrides": [ overrides: [
// These would otherwise currently break because of these issues: // These would otherwise currently break because of these issues:
// 1. `event:` https://github.com/eslint/doctrine/issues/221 and https://github.com/Kuniwak/jsdoctypeparser/pull/49 with https://github.com/Kuniwak/jsdoctypeparser/issues/47 // 1. `event:` https://github.com/eslint/doctrine/issues/221 and https://github.com/Kuniwak/jsdoctypeparser/pull/49 with https://github.com/Kuniwak/jsdoctypeparser/issues/47
// 1. `@implements`/`@augments`/`@extends`/`@override`: https://github.com/eslint/doctrine/issues/222 // 1. `@implements`/`@augments`/`@extends`/`@override`: https://github.com/eslint/doctrine/issues/222
{ {
"files": [ files: [
"test/utilities_test.js", "editor/svg-editor.js", "editor/svgcanvas.js", "test/utilities_test.js", "editor/svg-editor.js", "editor/svgcanvas.js",
"editor/coords.js", "editor/coords.js",
"editor/extensions/ext-eyedropper.js", "editor/extensions/ext-webappfind.js" "editor/extensions/ext-eyedropper.js", "editor/extensions/ext-webappfind.js"
], ],
"rules": { rules: {
"jsdoc/valid-types": "off", "jsdoc/valid-types": "off",
"valid-jsdoc": "off" "valid-jsdoc": "off"
} }
}, },
// Locales have no need for importing outside of SVG-Edit // Locales have no need for importing outside of SVG-Edit
{ {
"files": [ files: [
"editor/locale/lang.*.js", "editor/extensions/ext-locale/**", "editor/locale/lang.*.js", "editor/extensions/ext-locale/**",
"docs/tutorials/ExtensionDocs.md" "docs/tutorials/ExtensionDocs.md"
], ],
"rules": { rules: {
"import/no-anonymous-default-export": ["off"] "import/no-anonymous-default-export": ["off"]
} }
}, },
@@ -59,15 +59,15 @@ module.exports = {
// descriptive `svgEditor`; they also have no need for importing outside // descriptive `svgEditor`; they also have no need for importing outside
// of SVG-Edit // of SVG-Edit
{ {
"files": ["editor/extensions/**/ext-*.js"], files: ["editor/extensions/**/ext-*.js"],
"rules": { rules: {
"consistent-this": ["error", "svgEditor"], "consistent-this": ["error", "svgEditor"],
"import/no-anonymous-default-export": ["off"] "import/no-anonymous-default-export": ["off"]
} }
}, },
// These browser files don't do importing or requiring // These browser files don't do importing or requiring
{ {
"files": [ files: [
"editor/svgpathseg.js", "editor/touch.js", "editor/typedefs.js", "editor/svgpathseg.js", "editor/touch.js", "editor/typedefs.js",
"editor/redirect-on-no-module-support.js", "editor/redirect-on-no-module-support.js",
"editor/extensions/imagelib/index.js", "editor/extensions/imagelib/index.js",
@@ -77,7 +77,7 @@ module.exports = {
"firefox-extension/handlers.js", "firefox-extension/handlers.js",
"firefox-extension/content/svg-edit-overlay.js" "firefox-extension/content/svg-edit-overlay.js"
], ],
"rules": { rules: {
"import/unambiguous": ["off"] "import/unambiguous": ["off"]
} }
}, },
@@ -85,8 +85,8 @@ module.exports = {
// our use of `matchingFileName` in conjunction with // our use of `matchingFileName` in conjunction with
// `jsdoc/check-examples` within `ash-nazg`) // `jsdoc/check-examples` within `ash-nazg`)
{ {
"files": ["**/*.md"], files: ["**/*.md"],
"rules": { rules: {
"eol-last": ["off"], "eol-last": ["off"],
"no-console": ["off"], "no-console": ["off"],
"no-undef": ["off"], "no-undef": ["off"],
@@ -99,56 +99,56 @@ module.exports = {
}, },
// Dis-apply Node rules mistakenly giving errors with browser files // Dis-apply Node rules mistakenly giving errors with browser files
{ {
"files": ["editor/**", "test/**"], files: ["editor/**", "test/**"],
"rules": { rules: {
"node/no-unsupported-features/node-builtins": ["off"] "node/no-unsupported-features/node-builtins": ["off"]
} }
}, },
// We want console in tests! // We want console in tests!
{ {
"files": ["test/**"], files: ["test/**"],
"rules": { rules: {
"no-console": ["off"] "no-console": ["off"]
} }
}, },
{ {
// Node files // Node files
"files": [ files: [
"docs/jsdoc-config.js", "docs/jsdoc-config.js",
"build-html.js", "jsdoc-check-overly-generic-types.js", "build-html.js", "jsdoc-check-overly-generic-types.js",
"rollup.config.js", "rollup-config.config.js" "rollup.config.js", "rollup-config.config.js"
], ],
"env": { env: {
"node": true, node: true,
}, },
"rules": { rules: {
"node/no-unpublished-import": ["off"], "node/no-unpublished-import": ["off"],
"node/no-unsupported-features/es-syntax": ["off"] "node/no-unsupported-features/es-syntax": ["off"]
} }
}, },
{ {
// As consumed by jsdoc, cannot be expressed as ESM // As consumed by jsdoc, cannot be expressed as ESM
"files": ["docs/jsdoc-config.js"], files: ["docs/jsdoc-config.js"],
"parserOptions": { parserOptions: {
"sourceType": "script" sourceType: "script"
}, },
"rules": { rules: {
"import/no-commonjs": "off" "import/no-commonjs": "off"
} }
} }
], ],
"rules": { rules: {
// Override these `ash-nazg/sauron` rules which are difficult for us // Override these `ash-nazg/sauron` rules which are difficult for us
// to apply at this time // to apply at this time
"capitalized-comments": ["off"], "capitalized-comments": ["off"],
"complexity": ["off"], complexity: ["off"],
"default-case": ["off"], "default-case": ["off"],
"require-unicode-regexp": ["off"], "require-unicode-regexp": ["off"],
"no-magic-numbers": ["off"], "no-magic-numbers": ["off"],
"no-warning-comments": ["off"], "no-warning-comments": ["off"],
"max-len": ["off", { "max-len": ["off", {
"ignoreUrls": true, ignoreUrls: true,
"ignoreRegExpLiterals": true ignoreRegExpLiterals: true
}] }]
} }
}; };