- Linting (ESLint): List needed polyfills by directories so known whether users will need or just in development
parent
cc184a81ff
commit
fae7d33b8a
|
@ -23,6 +23,7 @@ editor/jspdf/underscore-min.js
|
||||||
|
|
||||||
editor/extensions/mathjax
|
editor/extensions/mathjax
|
||||||
|
|
||||||
|
# Todo: We should at least check `compat/compat` in our other files, however
|
||||||
editor/external/*
|
editor/external/*
|
||||||
!editor/external/dom-polyfill
|
!editor/external/dom-polyfill
|
||||||
editor/external/dom-polyfill/*
|
editor/external/dom-polyfill/*
|
||||||
|
|
157
.eslintrc.js
157
.eslintrc.js
|
@ -8,38 +8,6 @@ module.exports = {
|
||||||
},
|
},
|
||||||
settings: {
|
settings: {
|
||||||
polyfills: [
|
polyfills: [
|
||||||
"Array.isArray",
|
|
||||||
"Blob",
|
|
||||||
"console",
|
|
||||||
"Date.now",
|
|
||||||
"document.body",
|
|
||||||
"document.evaluate",
|
|
||||||
"document.head",
|
|
||||||
"document.importNode",
|
|
||||||
"document.querySelector", "document.querySelectorAll",
|
|
||||||
"DOMParser",
|
|
||||||
"Error",
|
|
||||||
"fetch",
|
|
||||||
"FileReader",
|
|
||||||
"history.pushState",
|
|
||||||
"history.replaceState",
|
|
||||||
"JSON",
|
|
||||||
"location.href",
|
|
||||||
"location.origin",
|
|
||||||
"CustomEvent",
|
|
||||||
"MutationObserver",
|
|
||||||
"Object.assign", "Object.defineProperty", "Object.defineProperties",
|
|
||||||
"Object.getOwnPropertyDescriptor",
|
|
||||||
"Object.entries", "Object.keys", "Object.values",
|
|
||||||
"Promise",
|
|
||||||
"Set",
|
|
||||||
"Uint8Array",
|
|
||||||
"URL",
|
|
||||||
"window.getComputedStyle",
|
|
||||||
"window.postMessage",
|
|
||||||
"window.scrollX", "window.scrollY",
|
|
||||||
"XMLHttpRequest",
|
|
||||||
"XMLSerializer"
|
|
||||||
],
|
],
|
||||||
jsdoc: {
|
jsdoc: {
|
||||||
additionalTagNames: {
|
additionalTagNames: {
|
||||||
|
@ -69,16 +37,6 @@ module.exports = {
|
||||||
"import/no-anonymous-default-export": ["off"]
|
"import/no-anonymous-default-export": ["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/**/ext-*.js"],
|
|
||||||
rules: {
|
|
||||||
"consistent-this": ["error", "svgEditor"],
|
|
||||||
"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: [
|
||||||
|
@ -96,7 +54,17 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
files: ['**/*.html'],
|
files: ['**/*.html', 'screencasts/**'],
|
||||||
|
globals: {
|
||||||
|
root: "off"
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
'document.querySelector',
|
||||||
|
'history.pushState',
|
||||||
|
'history.replaceState'
|
||||||
|
]
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'import/unambiguous': 'off'
|
'import/unambiguous': 'off'
|
||||||
}
|
}
|
||||||
|
@ -105,6 +73,13 @@ module.exports = {
|
||||||
// our use of `jsdoc/check-examples` within `ash-nazg`)
|
// our use of `jsdoc/check-examples` within `ash-nazg`)
|
||||||
{
|
{
|
||||||
files: ["**/*.md"],
|
files: ["**/*.md"],
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
// Tutorials
|
||||||
|
'console',
|
||||||
|
'location.href'
|
||||||
|
]
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
"eol-last": ["off"],
|
"eol-last": ["off"],
|
||||||
"no-console": ["off"],
|
"no-console": ["off"],
|
||||||
|
@ -125,14 +100,71 @@ module.exports = {
|
||||||
// Dis-apply Node rules mistakenly giving errors with browser files,
|
// Dis-apply Node rules mistakenly giving errors with browser files,
|
||||||
// and treating Node global `root` as being present for shadowing
|
// and treating Node global `root` as being present for shadowing
|
||||||
{
|
{
|
||||||
files: ["editor/**", "screencasts/**"],
|
files: ["editor/**"],
|
||||||
globals: {
|
globals: {
|
||||||
root: "off"
|
root: "off"
|
||||||
},
|
},
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
// These are the primary polyfills needed by regular users if not present,
|
||||||
|
// e.g., with core-js-bundle; also those under extensions
|
||||||
|
'Array.isArray',
|
||||||
|
'Blob',
|
||||||
|
'console',
|
||||||
|
'CustomEvent',
|
||||||
|
'document.body',
|
||||||
|
'document.evaluate',
|
||||||
|
'document.head',
|
||||||
|
'document.importNode',
|
||||||
|
'document.querySelectorAll',
|
||||||
|
'DOMParser',
|
||||||
|
'Error',
|
||||||
|
'FileReader',
|
||||||
|
'JSON',
|
||||||
|
'location.href',
|
||||||
|
'MutationObserver',
|
||||||
|
'Object.assign',
|
||||||
|
'Object.defineProperty',
|
||||||
|
'Object.defineProperties',
|
||||||
|
'Object.entries',
|
||||||
|
'Object.getOwnPropertyDescriptor',
|
||||||
|
'Object.keys',
|
||||||
|
'Object.values',
|
||||||
|
'Promise',
|
||||||
|
'Promise.all',
|
||||||
|
'Set',
|
||||||
|
'Uint8Array',
|
||||||
|
'URL',
|
||||||
|
'URL.createObjectURL',
|
||||||
|
'XMLSerializer',
|
||||||
|
'XMLHttpRequest',
|
||||||
|
'window.getComputedStyle',
|
||||||
|
'window.scrollX',
|
||||||
|
'window.scrollY'
|
||||||
|
]
|
||||||
|
},
|
||||||
rules: {
|
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/**"],
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
'console',
|
||||||
|
'fetch',
|
||||||
|
'location.origin',
|
||||||
|
'window.postMessage'
|
||||||
|
]
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"consistent-this": ["error", "svgEditor"],
|
||||||
|
"import/no-anonymous-default-export": ["off"]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// Node files
|
// Node files
|
||||||
files: [
|
files: [
|
||||||
|
@ -143,6 +175,12 @@ module.exports = {
|
||||||
env: {
|
env: {
|
||||||
node: true,
|
node: true,
|
||||||
},
|
},
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
'console',
|
||||||
|
'Promise.resolve'
|
||||||
|
]
|
||||||
|
},
|
||||||
globals: {
|
globals: {
|
||||||
require: true
|
require: true
|
||||||
},
|
},
|
||||||
|
@ -175,12 +213,43 @@ module.exports = {
|
||||||
'build/testing-badge.js'
|
'build/testing-badge.js'
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// Should probably have as external, but should still check
|
||||||
|
files: ['canvg/rgbcolor.js'],
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
'Object.assign',
|
||||||
|
'Object.keys'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// Misc. probably to remove
|
||||||
|
files: ['firefox-extension/**', 'opera-widget/**'],
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
'console'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
files: ["cypress/**"],
|
files: ["cypress/**"],
|
||||||
extends: ["plugin:cypress/recommended"],
|
extends: ["plugin:cypress/recommended"],
|
||||||
env: {
|
env: {
|
||||||
node: true
|
node: true
|
||||||
},
|
},
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
'console',
|
||||||
|
'Date.now',
|
||||||
|
'document.body',
|
||||||
|
'document.head',
|
||||||
|
'DOMParser',
|
||||||
|
'Object.keys',
|
||||||
|
'Object.entries',
|
||||||
|
'Promise'
|
||||||
|
]
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': 0,
|
'no-console': 0,
|
||||||
'import/unambiguous': 0,
|
'import/unambiguous': 0,
|
||||||
|
|
Loading…
Reference in New Issue