diff --git a/.eslintignore b/.eslintignore index 544d77ff..383096a6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -32,3 +32,4 @@ editor/external/dom-polyfill/* mochawesome-report releases +!.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 15ca9632..b7af0acc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,9 @@ +'use strict'; + module.exports = { - extends: ["ash-nazg/sauron-node"], + extends: ['ash-nazg/sauron-node'], parserOptions: { - sourceType: "module" + sourceType: 'module' }, env: { browser: true @@ -14,13 +16,13 @@ module.exports = { // In case we need to extend customTags: [] }, - augmentsExtendsReplacesDocs: true, + augmentsExtendsReplacesDocs: true // Todo: Figure out why this is not working and why seem to have to // disable for all Markdown: /* baseConfig: { rules: { - "no-multi-spaces": "off" + 'no-multi-spaces': 'off' } } */ @@ -30,30 +32,30 @@ module.exports = { // Locales have no need for importing outside of SVG-Edit { files: [ - "editor/locale/lang.*.js", "editor/extensions/ext-locale/**", - "docs/tutorials/ExtensionDocs.md" + 'editor/locale/lang.*.js', 'editor/extensions/ext-locale/**', + 'docs/tutorials/ExtensionDocs.md' ], rules: { - "import/no-anonymous-default-export": ["off"] + 'import/no-anonymous-default-export': ['off'] } }, // These browser files don't do importing or requiring { files: [ - "editor/svgpathseg.js", "editor/touch.js", "editor/typedefs.js", - "editor/redirect-on-no-module-support.js", - "editor/extensions/imagelib/index.js", - "editor/external/dom-polyfill/dom-polyfill.js", - "screencasts/svgopen2010/script.js" + 'editor/svgpathseg.js', 'editor/touch.js', 'editor/typedefs.js', + 'editor/redirect-on-no-module-support.js', + 'editor/extensions/imagelib/index.js', + 'editor/external/dom-polyfill/dom-polyfill.js', + 'screencasts/svgopen2010/script.js' ], rules: { - "import/unambiguous": ["off"] + 'import/unambiguous': ['off'] } }, { files: ['**/*.html', 'screencasts/**'], globals: { - root: "off" + root: 'off' }, settings: { polyfills: [ @@ -66,10 +68,19 @@ module.exports = { 'import/unambiguous': 'off' } }, + { + files: '.eslintrc.js', + extends: [ + 'plugin:node/recommended-script' + ], + rules: { + 'import/no-commonjs': 0 + } + }, // Our Markdown rules (and used for JSDoc examples as well, by way of // our use of `jsdoc/check-examples` within `ash-nazg`) { - files: ["**/*.md"], + files: ['**/*.md'], settings: { polyfills: [ // Tutorials @@ -78,28 +89,28 @@ module.exports = { ] }, rules: { - "eol-last": ["off"], - "no-console": ["off"], - "no-undef": ["off"], - "no-unused-vars": ["warn"], - "padded-blocks": ["off"], - "import/unambiguous": ["off"], - "import/no-unresolved": ["off"], - "node/no-missing-import": ["off"], - "no-multi-spaces": "off", - "sonarjs/no-all-duplicated-branches": "off", + 'eol-last': ['off'], + 'no-console': ['off'], + 'no-undef': ['off'], + 'no-unused-vars': ['warn'], + 'padded-blocks': ['off'], + 'import/unambiguous': ['off'], + 'import/no-unresolved': ['off'], + 'node/no-missing-import': ['off'], + 'no-multi-spaces': 'off', + 'sonarjs/no-all-duplicated-branches': 'off', 'node/no-unpublished-import': ['error', {allowModules: ['@cypress/fiddle']}], - "no-alert": "off", + 'no-alert': 'off', // Disable until may fix https://github.com/gajus/eslint-plugin-jsdoc/issues/211 - "indent": "off" + indent: 'off' } }, // Dis-apply Node rules mistakenly giving errors with browser files, // and treating Node global `root` as being present for shadowing { - files: ["editor/**"], + files: ['editor/**'], globals: { - root: "off" + root: 'off' }, settings: { polyfills: [ @@ -141,14 +152,14 @@ module.exports = { ] }, rules: { - "node/no-unsupported-features/node-builtins": "off" + 'node/no-unsupported-features/node-builtins': 'off' } }, // For extensions, `this` is generally assigned to be the more // descriptive `svgEditor`; they also have no need for importing outside // of SVG-Edit { - files: ["editor/extensions/**"], + files: ['editor/extensions/**'], settings: { polyfills: [ 'console', @@ -158,19 +169,19 @@ module.exports = { ] }, rules: { - "consistent-this": ["error", "svgEditor"], - "import/no-anonymous-default-export": ["off"] + 'consistent-this': ['error', 'svgEditor'], + 'import/no-anonymous-default-export': ['off'] } }, { // Node files files: [ - "docs/jsdoc-config.js", - "build/build-html.js", - "rollup.config.js", "rollup-config.config.js" + 'docs/jsdoc-config.js', + 'build/build-html.js', + 'rollup.config.js', 'rollup-config.config.js' ], env: { - node: true, + node: true }, settings: { polyfills: [ @@ -186,21 +197,21 @@ module.exports = { // and we have too many modules to add to `peerDependencies` // so this rule can know them to be available, so we instead // disable - "node/no-unpublished-import": "off" + 'node/no-unpublished-import': 'off' } }, { // As consumed by jsdoc, cannot be expressed as ESM - files: ["docs/jsdoc-config.js"], + files: ['docs/jsdoc-config.js'], parserOptions: { - sourceType: "script" + sourceType: 'script' }, globals: { - "module": false + module: false }, rules: { - "import/no-commonjs": "off", - "strict": "off" + 'import/no-commonjs': 'off', + strict: 'off' } }, { @@ -221,8 +232,22 @@ module.exports = { } }, { - files: ["cypress/**"], - extends: ["plugin:cypress/recommended"], + files: ['cypress/plugins/index.js'], + extends: [ + 'plugin:node/recommended-script' + ], + rules: { + 'import/no-commonjs': 0 + } + }, + { + files: ['cypress/**'], + extends: [ + 'plugin:cypress/recommended', + 'plugin:mocha/recommended', + 'plugin:chai-friendly/recommended', + 'plugin:chai-expect/recommended' + ], env: { node: true }, @@ -239,54 +264,73 @@ module.exports = { ] }, rules: { + // Would be good but seems necessary due to some bugs in Cypress + // in detecting visibility + // 'cypress/no-force': 0, + // Good but would be difficult to enforce (and data-* may not be less + // brittle than IDs/classes anyways) + // 'cypress/require-data-selectors': 0, + 'cypress/assertion-before-screenshot': 2, + + // Too oppressive when planning to extend a section + 'mocha/no-hooks-for-single-case': 0, + + // Would be good to enable but needs some refactoring + 'mocha/no-setup-in-describe': 0, + + // Useful to ensure allowing `this.timeout()`, etc., but a little oppressive + 'mocha/no-mocha-arrows': 0, + // Useful if enabling the regular `prefer-arrow-callback` + // 'mocha/prefer-arrow-callback': 2 + 'jsdoc/require-jsdoc': 0, 'no-console': 0, - 'import/unambiguous': 0, + 'import/unambiguous': 0 } } ], rules: { // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/453 - "unicorn/regex-shorthand": 0, + 'unicorn/regex-shorthand': 0, // The Babel transform seems to have a problem converting these - "prefer-named-capture-group": "off", + 'prefer-named-capture-group': 'off', // Override these `ash-nazg/sauron` rules which are difficult for us // to apply at this time - "unicorn/prefer-string-slice": "off", - "default-case": "off", - "require-unicode-regexp": "off", - "max-len": ["off", { + 'unicorn/prefer-string-slice': 'off', + 'default-case': 'off', + 'require-unicode-regexp': 'off', + 'max-len': ['off', { ignoreUrls: true, ignoreRegExpLiterals: true }], - "unicorn/prefer-query-selector": "off", - "unicorn/prefer-node-append": "off", - "unicorn/no-zero-fractions": "off", - "jsdoc/require-file-overview": ["error", { + 'unicorn/prefer-query-selector': 'off', + 'unicorn/prefer-node-append': 'off', + 'unicorn/no-zero-fractions': 'off', + 'jsdoc/require-file-overview': ['error', { tags: { file: { - "initialCommentsOnly": true, - "preventDuplicates": true, + initialCommentsOnly: true, + preventDuplicates: true }, license: { - "initialCommentsOnly": true, - "preventDuplicates": true, + initialCommentsOnly: true, + preventDuplicates: true }, copyright: { - "initialCommentsOnly": true, - "preventDuplicates": true, + initialCommentsOnly: true, + preventDuplicates: true }, author: { - "initialCommentsOnly": true, - "preventDuplicates": true, + initialCommentsOnly: true, + preventDuplicates: true }, module: { - "initialCommentsOnly": true, - "preventDuplicates": true, + initialCommentsOnly: true, + preventDuplicates: true }, exports: { - "initialCommentsOnly": true, - "preventDuplicates": true, + initialCommentsOnly: true, + preventDuplicates: true } } }] diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 814eef45..e9e3eab1 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -1,5 +1,4 @@ -/* globals module, require */ -/* eslint-disable import/no-commonjs */ +'use strict'; // *********************************************************** // This example plugins/index.js can be used to load plugins @@ -11,18 +10,7 @@ // https://on.cypress.io/plugins-guide // *********************************************************** -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -const codeCoverageTask = require('@cypress/code-coverage/task.js'); - -module.exports = (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - - // https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin - on('task', codeCoverageTask); -}; +require('@babel/register')({ + plugins: ['@babel/plugin-transform-modules-commonjs'] +}); +module.exports = require('./main.js').default; diff --git a/cypress/plugins/main.js b/cypress/plugins/main.js new file mode 100644 index 00000000..5d2f6aa1 --- /dev/null +++ b/cypress/plugins/main.js @@ -0,0 +1,16 @@ +// This function is called when a project is opened or re-opened (e.g. due to +// the project's config changing) + +import codeCoverageTask from '@cypress/code-coverage/task.js'; + +// eslint-disable-next-line import/no-anonymous-default-export +export default (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config + + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config + + // https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin + on('task', codeCoverageTask); +}; diff --git a/package-lock.json b/package-lock.json index 10fbf7c9..1b8abef7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2130,139 +2130,6 @@ "integrity": "sha512-KyqT0kkdxgbGys9mvo/1Mgdt/LGvUFPCZIK9pWPIfOM2mYzMDd/eVYy4sMP1YqvVI129k0alxRyM53H2MAs/Nw==", "dev": true }, - "@cypress/browserify-preprocessor": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@cypress/browserify-preprocessor/-/browserify-preprocessor-2.1.1.tgz", - "integrity": "sha512-S+0bzZbRsiFbrLkEygu5D0958z4ejio7hWxnO5MoSqD7SmZOmGRpjuZ9RaGcDmL6RWnklNjn8DkpP2s368qCKA==", - "dev": true, - "requires": { - "@babel/core": "7.4.5", - "@babel/plugin-proposal-class-properties": "7.3.0", - "@babel/plugin-proposal-object-rest-spread": "7.3.2", - "@babel/plugin-transform-runtime": "7.2.0", - "@babel/preset-env": "7.4.5", - "@babel/preset-react": "7.0.0", - "@babel/runtime": "7.3.1", - "babel-plugin-add-module-exports": "1.0.0", - "babelify": "10.0.0", - "bluebird": "3.5.3", - "browserify": "16.2.3", - "coffeeify": "3.0.1", - "coffeescript": "1.12.7", - "debug": "4.1.1", - "fs-extra": "7.0.1", - "lodash.clonedeep": "4.5.0", - "watchify": "3.11.1" - }, - "dependencies": { - "@babel/core": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.5.tgz", - "integrity": "sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "@babel/generator": "^7.4.4", - "@babel/helpers": "^7.4.4", - "@babel/parser": "^7.4.5", - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.4.5", - "@babel/types": "^7.4.4", - "convert-source-map": "^1.1.0", - "debug": "^4.1.0", - "json5": "^2.1.0", - "lodash": "^4.17.11", - "resolve": "^1.3.2", - "semver": "^5.4.1", - "source-map": "^0.5.0" - } - }, - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.2.tgz", - "integrity": "sha512-DjeMS+J2+lpANkYLLO+m6GjoTMygYglKmRe6cDTbFv3L9i6mmiE8fe6B8MtCSLZpVXscD5kn7s6SgtHrDoBWoA==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0" - } - }, - "@babel/preset-env": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.4.5.tgz", - "integrity": "sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w==", - "dev": true, - "requires": { - "@babel/helper-module-imports": "^7.0.0", - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-proposal-async-generator-functions": "^7.2.0", - "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.4.4", - "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", - "@babel/plugin-syntax-async-generators": "^7.2.0", - "@babel/plugin-syntax-json-strings": "^7.2.0", - "@babel/plugin-syntax-object-rest-spread": "^7.2.0", - "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", - "@babel/plugin-transform-arrow-functions": "^7.2.0", - "@babel/plugin-transform-async-to-generator": "^7.4.4", - "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.4.4", - "@babel/plugin-transform-classes": "^7.4.4", - "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.4.4", - "@babel/plugin-transform-dotall-regex": "^7.4.4", - "@babel/plugin-transform-duplicate-keys": "^7.2.0", - "@babel/plugin-transform-exponentiation-operator": "^7.2.0", - "@babel/plugin-transform-for-of": "^7.4.4", - "@babel/plugin-transform-function-name": "^7.4.4", - "@babel/plugin-transform-literals": "^7.2.0", - "@babel/plugin-transform-member-expression-literals": "^7.2.0", - "@babel/plugin-transform-modules-amd": "^7.2.0", - "@babel/plugin-transform-modules-commonjs": "^7.4.4", - "@babel/plugin-transform-modules-systemjs": "^7.4.4", - "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", - "@babel/plugin-transform-new-target": "^7.4.4", - "@babel/plugin-transform-object-super": "^7.2.0", - "@babel/plugin-transform-parameters": "^7.4.4", - "@babel/plugin-transform-property-literals": "^7.2.0", - "@babel/plugin-transform-regenerator": "^7.4.5", - "@babel/plugin-transform-reserved-words": "^7.2.0", - "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.0", - "@babel/plugin-transform-sticky-regex": "^7.2.0", - "@babel/plugin-transform-template-literals": "^7.4.4", - "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/types": "^7.4.4", - "browserslist": "^4.6.0", - "core-js-compat": "^3.1.1", - "invariant": "^2.2.2", - "js-levenshtein": "^1.1.3", - "semver": "^5.5.0" - }, - "dependencies": { - "@babel/plugin-proposal-object-rest-spread": { - "version": "7.7.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.7.7.tgz", - "integrity": "sha512-3qp9I8lelgzNedI3hrhkvhaEYree6+WHnyA/q4Dza9z7iEIs1eyhWyJnetk3jJ69RT0AT4G0UhEGwyGFJ7GUuQ==", - "dev": true, - "requires": { - "@babel/helper-plugin-utils": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.7.4" - } - } - } - }, - "coffeescript": { - "version": "1.12.7", - "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.12.7.tgz", - "integrity": "sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA==", - "dev": true - } - } - }, "@cypress/code-coverage": { "version": "1.12.1", "resolved": "https://registry.npmjs.org/@cypress/code-coverage/-/code-coverage-1.12.1.tgz", @@ -2436,6 +2303,165 @@ "debug": "4.1.1", "safe-marked": "2.0.0", "temp-write": "4.0.0" + }, + "dependencies": { + "@babel/core": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.4.5.tgz", + "integrity": "sha512-OvjIh6aqXtlsA8ujtGKfC7LYWksYSX8yQcM8Ay3LuvVeQ63lcOKgoZWVqcpFwkd29aYU9rVx7jxhfhiEDV9MZA==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.4.4", + "@babel/helpers": "^7.4.4", + "@babel/parser": "^7.4.5", + "@babel/template": "^7.4.4", + "@babel/traverse": "^7.4.5", + "@babel/types": "^7.4.4", + "convert-source-map": "^1.1.0", + "debug": "^4.1.0", + "json5": "^2.1.0", + "lodash": "^4.17.11", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.2.tgz", + "integrity": "sha512-DjeMS+J2+lpANkYLLO+m6GjoTMygYglKmRe6cDTbFv3L9i6mmiE8fe6B8MtCSLZpVXscD5kn7s6SgtHrDoBWoA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-syntax-object-rest-spread": "^7.2.0" + } + }, + "@babel/preset-env": { + "version": "7.4.5", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.4.5.tgz", + "integrity": "sha512-f2yNVXM+FsR5V8UwcFeIHzHWgnhXg3NpRmy0ADvALpnhB0SLbCvrCRr4BLOUYbQNLS+Z0Yer46x9dJXpXewI7w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-async-generator-functions": "^7.2.0", + "@babel/plugin-proposal-json-strings": "^7.2.0", + "@babel/plugin-proposal-object-rest-spread": "^7.4.4", + "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-syntax-async-generators": "^7.2.0", + "@babel/plugin-syntax-json-strings": "^7.2.0", + "@babel/plugin-syntax-object-rest-spread": "^7.2.0", + "@babel/plugin-syntax-optional-catch-binding": "^7.2.0", + "@babel/plugin-transform-arrow-functions": "^7.2.0", + "@babel/plugin-transform-async-to-generator": "^7.4.4", + "@babel/plugin-transform-block-scoped-functions": "^7.2.0", + "@babel/plugin-transform-block-scoping": "^7.4.4", + "@babel/plugin-transform-classes": "^7.4.4", + "@babel/plugin-transform-computed-properties": "^7.2.0", + "@babel/plugin-transform-destructuring": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/plugin-transform-duplicate-keys": "^7.2.0", + "@babel/plugin-transform-exponentiation-operator": "^7.2.0", + "@babel/plugin-transform-for-of": "^7.4.4", + "@babel/plugin-transform-function-name": "^7.4.4", + "@babel/plugin-transform-literals": "^7.2.0", + "@babel/plugin-transform-member-expression-literals": "^7.2.0", + "@babel/plugin-transform-modules-amd": "^7.2.0", + "@babel/plugin-transform-modules-commonjs": "^7.4.4", + "@babel/plugin-transform-modules-systemjs": "^7.4.4", + "@babel/plugin-transform-modules-umd": "^7.2.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", + "@babel/plugin-transform-new-target": "^7.4.4", + "@babel/plugin-transform-object-super": "^7.2.0", + "@babel/plugin-transform-parameters": "^7.4.4", + "@babel/plugin-transform-property-literals": "^7.2.0", + "@babel/plugin-transform-regenerator": "^7.4.5", + "@babel/plugin-transform-reserved-words": "^7.2.0", + "@babel/plugin-transform-shorthand-properties": "^7.2.0", + "@babel/plugin-transform-spread": "^7.2.0", + "@babel/plugin-transform-sticky-regex": "^7.2.0", + "@babel/plugin-transform-template-literals": "^7.4.4", + "@babel/plugin-transform-typeof-symbol": "^7.2.0", + "@babel/plugin-transform-unicode-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "browserslist": "^4.6.0", + "core-js-compat": "^3.1.1", + "invariant": "^2.2.2", + "js-levenshtein": "^1.1.3", + "semver": "^5.5.0" + }, + "dependencies": { + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.0" + }, + "dependencies": { + "@babel/helper-plugin-utils": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz", + "integrity": "sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ==", + "dev": true + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + } + } + } + } + }, + "@cypress/browserify-preprocessor": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@cypress/browserify-preprocessor/-/browserify-preprocessor-2.1.1.tgz", + "integrity": "sha512-S+0bzZbRsiFbrLkEygu5D0958z4ejio7hWxnO5MoSqD7SmZOmGRpjuZ9RaGcDmL6RWnklNjn8DkpP2s368qCKA==", + "dev": true, + "requires": { + "@babel/core": "7.4.5", + "@babel/plugin-proposal-class-properties": "7.3.0", + "@babel/plugin-proposal-object-rest-spread": "7.3.2", + "@babel/plugin-transform-runtime": "7.2.0", + "@babel/preset-env": "7.4.5", + "@babel/preset-react": "7.0.0", + "@babel/runtime": "7.3.1", + "babel-plugin-add-module-exports": "1.0.0", + "babelify": "10.0.0", + "bluebird": "3.5.3", + "browserify": "16.2.3", + "coffeeify": "3.0.1", + "coffeescript": "1.12.7", + "debug": "4.1.1", + "fs-extra": "7.0.1", + "lodash.clonedeep": "4.5.0", + "watchify": "3.11.1" + } + }, + "babel-plugin-add-module-exports": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.0.tgz", + "integrity": "sha512-m0sMxPL4FaN2K69GQgaRJa4Ny15qKSdoknIcpN+gz+NaJlAW9pge/povs13tPYsKDboflrEQC+/3kfIsONBTaw==", + "dev": true, + "requires": { + "chokidar": "^2.0.4" + } + }, + "coffeescript": { + "version": "1.12.7", + "resolved": "https://registry.npmjs.org/coffeescript/-/coffeescript-1.12.7.tgz", + "integrity": "sha512-pLXHFxQMPklVoEekowk8b3erNynC+DVJzChxS/LCBBgR6/8AJkHivkm//zbowcfc7BTCAjryuhx6gPqPRfsFoA==", + "dev": true + } } }, "@cypress/listr-verbose-renderer": { @@ -3246,15 +3272,6 @@ "integrity": "sha512-wJqOIreoFiGjvZ1UZvGLAUs8H3QQ3cS833+6ctFcCdr/xFd5oB66mmwGWnwQlBXFFaefRt+KR+m2dY9em2RxVg==", "dev": true }, - "babel-plugin-add-module-exports": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-1.0.0.tgz", - "integrity": "sha512-m0sMxPL4FaN2K69GQgaRJa4Ny15qKSdoknIcpN+gz+NaJlAW9pge/povs13tPYsKDboflrEQC+/3kfIsONBTaw==", - "dev": true, - "requires": { - "chokidar": "^2.0.4" - } - }, "babel-plugin-dynamic-import-node": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz", @@ -5953,6 +5970,18 @@ "integrity": "sha512-uRfJ4d9Fyyvxm6/w++++RSQoXZyERFF0+6zqupgg5Mw/+eG4y19yrptTghJlApntKlPZBpA4XCOIBzJbvLrArQ==", "dev": true }, + "eslint-plugin-chai-expect": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-chai-expect/-/eslint-plugin-chai-expect-2.1.0.tgz", + "integrity": "sha512-rd0/4mjMV6c3i0o4DKkWI4uaFN9DK707kW+/fDphaDI6HVgxXnhML9Xgt5vHnTXmSSnDhupuCFBgsEAEpchXmQ==", + "dev": true + }, + "eslint-plugin-chai-friendly": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-chai-friendly/-/eslint-plugin-chai-friendly-0.5.0.tgz", + "integrity": "sha512-Pxe6z8C9fP0pn2X2nGFU/b3GBOCM/5FVus1hsMwJsXP3R7RiXFl7g0ksJbsc0GxiLyidTW4mEFk77qsNn7Tk7g==", + "dev": true + }, "eslint-plugin-compat": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/eslint-plugin-compat/-/eslint-plugin-compat-3.5.1.tgz", @@ -5992,9 +6021,9 @@ } }, "eslint-plugin-cypress": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.9.0.tgz", - "integrity": "sha512-3x6EQYDB30VHyqFV6leBRf9Zo51FsPWXG+aLtpUSlRtcLGcrbmnfno02E318YYSmGbCJH6K5i+MLCFHBpcyreg==", + "version": "2.10.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-cypress/-/eslint-plugin-cypress-2.10.3.tgz", + "integrity": "sha512-CvFeoCquShfO8gHNIKA1VpUTz78WtknMebLemBd1lRbcmJNjwpqCqpQYUG/XVja8GjdX/e2TJXYa+EUBxehtUg==", "dev": true, "requires": { "globals": "^11.12.0" @@ -6124,6 +6153,33 @@ "unified": "^6.1.2" } }, + "eslint-plugin-mocha": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-mocha/-/eslint-plugin-mocha-6.3.0.tgz", + "integrity": "sha512-Cd2roo8caAyG21oKaaNTj7cqeYRWW1I2B5SfpKRp0Ip1gkfwoR1Ow0IGlPWnNjzywdF4n+kHL8/9vM6zCJUxdg==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "ramda": "^0.27.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.0.0.tgz", + "integrity": "sha512-0HCPuJv+7Wv1bACm8y5/ECVfYdfsAm9xmVb7saeFlxjPYALefjhbYoCkBjPdPzGH8wWyTpAez82Fh3VKYEZ8OA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "ramda": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.0.tgz", + "integrity": "sha512-pVzZdDpWwWqEVVLshWUHjNwuVP7SfcmPraYuqocJp1yo2U1R7P+5QAfDhdItkuoGqIBnBYrtPp7rEPqDn9HlZA==", + "dev": true + } + } + }, "eslint-plugin-no-unsanitized": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/eslint-plugin-no-unsanitized/-/eslint-plugin-no-unsanitized-3.0.2.tgz", diff --git a/package.json b/package.json index 43aa9a8b..8a92ffe6 100644 --- a/package.json +++ b/package.json @@ -14,20 +14,16 @@ }, "scripts": { "add-release": "git submodule add -b \"release-v$VERSION\" https://github.com/SVG-Edit/svgedit.git \"releases/svg-edit-$VERSION\" && git submodule set-branch -b \"release-v$VERSION\" releases/latest", - "start-allow-origin": "static -p 8001 -H '{\"Access-Control-Allow-Origin\": \"*\"}'", "start-embedded": "run-p start start-allow-origin", "start": "echo \"Open file, e.g., to http://localhost:8000/editor/svg-editor-es.html\" && static -p 8000", - "open-docs-no-start": "open-cli http://localhost:8000/docs/jsdoc/", "open-docs": "run-p start open-docs-no-start", - "build-docs-remove": "rimraf \"docs/jsdoc/*\"", "build-docs-create": "jsdoc --pedantic -c docs/jsdoc-config.js editor", "build-docs": "run-s -c build-docs-remove build-docs-create", "build-and-open-docs-no-start": "run-s build-docs open-docs-no-start", "build-and-open-docs": "run-s build-docs open-docs", - "open-embedded-no-start": "open-cli http://localhost:8000/editor/embedapi.html", "open-embedded": "run-p start-embedded open-embedded-no-start", "open-all-ext-no-start": "open-cli http://localhost:8000/editor/svg-editor-es.html?extensions=ext-arrows.js,ext-closepath.js,ext-foreignobject.js,ext-helloworld.js,ext-mathjax.js,ext-php_savefile.js,ext-server_moinsave.js,ext-server_opensave.js,ext-webappfind.js,ext-xdomain-messaging.js", @@ -36,48 +32,38 @@ "open-compiled": "run-p start open-compiled-no-start", "open-no-start": "open-cli http://localhost:8000/editor/svg-editor-es.html", "open": "run-p start open-no-start", - "open-cov-no-start": "open-cli http://localhost:8000/coverage/", "open-cov": "run-p start open-cov-no-start", - "instrument:replace-html": "frs-replace \"../svgedit-config-es.js\" \"svgedit-config-es.js\" -i instrumented/svg-editor-es.html -o instrumented/svg-editor-es.html", "instrument:replace-js": "frs-replace \"editor/svg-editor.js\" \"svg-editor.js\" -i svgedit-config-es.js -o instrumented/svgedit-config-es.js", "instrument:copy-excluded": "node cypress/support/copy.js", "copy-instrumented": "copyfiles -e \"**/*.js\" -u 1 \"editor/**/*\" instrumented && npm run instrument:replace-html && npm run instrument:replace-js && npm run instrument:copy-excluded", "instrument": "rimraf instrumented && nyc instrument editor instrumented && npm run copy-instrumented", - "report": "nyc report", "report-summary": "nyc report --reporter=text-summary", - "license-badge": "license-badger --uncategorizedLicenseTemplate \"\\${license} (\\${name} (\\${version}))\" --filteredTypes=nonempty --textTemplate \"License types\n(project, deps, and bundled devDeps)\" --packageJson --production badges/licenses-badge.svg", "license-badge-dev": "license-badger --corrections --filteredTypes=nonempty --textTemplate \"License types\n(all devDeps)\" --allDevelopment badges/licenses-badge-dev.svg", "license-badges": "run-p license-badge license-badge-dev", "coverage-badge": "coveradge badges/coverage-badge", - "compress-images": "imageoptim \"editor/extensions/*.png\" \"editor/spinbtn/*.png\" \"editor/jgraduate/images/*.{png,gif}\" \"editor/images/*.png\"", "copy": "copyfiles -f node_modules/load-stylesheets/dist/index-es.js editor/external/load-stylesheets && copyfiles -f node_modules/jamilih/dist/jml-es.js editor/external/jamilih && copyfiles -f node_modules/query-result/esm/index.js editor/external/query-result/esm && copyfiles -f node_modules/qr-manipulation/dist/index-es.js editor/external/qr-manipulation/dist && copyfiles -f node_modules/stackblur-canvas/dist/stackblur-es.js editor/external/stackblur-canvas/dist && copyfiles -f node_modules/regenerator-runtime/runtime.js editor/external/regenerator-runtime && copyfiles -f \"node_modules/core-js-bundle//minified*\" editor/external/core-js-bundle && copyfiles -f \"node_modules/underscore/underscore-*\" editor/jspdf && copyfiles -f \"node_modules/deparam/dist/deparam.esm.js\" editor/external/deparam", "remark": "remark -q -f .", - "build-html": "babel-node --plugins @babel/plugin-transform-modules-commonjs build/build-html.js", "eslint-fix": "eslint --fix --ext js,md,html .", "eslint": "eslint --ext js,md,html .", "rollup": "rollup -c", - "build-by-config": "rollup -c rollup-config.config.js", "prep-no-core-rollup": "run-s eslint build-html build-by-config", "prep": "run-s prep-no-core-rollup rollup", "prepublishOnly": "npm run prep", - "cypress:open-no-start": "cypress open", "cypress:open": "run-p start cypress:open-no-start", "open-tests": "run-s instrument cypress:open", - "cypress:merge": "mochawesome-merge \"cypress/results/mochaw*.json\" > mochawesome.json && marge mochawesome.json && mbg --file ./mochawesome.json --badge_output badges/tests-badge.svg", "cypress:run-only": "rimraf \"cypress/results/mochaw*.json\" && rimraf \".nyc_output/*\" && cypress run", "cypress:run-no-badge": "run-s -c cypress:run-only cypress:merge", "cypress:run": "run-s -c cypress:run-no-badge coverage-badge", "test-only-no-report": "run-p start cypress:run", - "test-only": "run-s -c test-only-no-report report", "test-no-cov-no-core-rollup": "run-s prep-no-core-rollup test-only", "test-no-cov": "run-s prep test-only", @@ -150,6 +136,7 @@ "@babel/plugin-transform-modules-commonjs": "^7.8.3", "@babel/plugin-transform-named-capturing-groups-regex": "^7.8.3", "@babel/preset-env": "^7.8.4", + "@babel/register": "^7.8.3", "@cypress/code-coverage": "^1.12.1", "@cypress/fiddle": "^1.4.0", "@mysticatea/eslint-plugin": "^13.0.0", @@ -167,13 +154,16 @@ "eslint-config-ash-nazg": "^17.2.0", "eslint-config-standard": "^14.1.0", "eslint-plugin-array-func": "^3.1.3", + "eslint-plugin-chai-expect": "^2.1.0", + "eslint-plugin-chai-friendly": "^0.5.0", "eslint-plugin-compat": "^3.5.1", - "eslint-plugin-cypress": "^2.9.0", + "eslint-plugin-cypress": "^2.10.3", "eslint-plugin-eslint-comments": "^3.1.2", "eslint-plugin-html": "^6.0.0", "eslint-plugin-import": "^2.20.1", "eslint-plugin-jsdoc": "^21.0.0", "eslint-plugin-markdown": "^1.0.1", + "eslint-plugin-mocha": "^6.3.0", "eslint-plugin-no-unsanitized": "^3.0.2", "eslint-plugin-no-use-extend-native": "^0.4.1", "eslint-plugin-node": "^11.0.0",