|
|
@@ -1,3 +1,12 @@
|
|
|
+const unsafeEnvironment = [
|
|
|
+ 'src/injected/**/*.js',
|
|
|
+ // these are used by `injected`
|
|
|
+ 'src/common/browser.js',
|
|
|
+ 'src/common/consts.js',
|
|
|
+ 'src/common/index.js',
|
|
|
+ 'src/common/object.js',
|
|
|
+ 'src/common/util.js',
|
|
|
+];
|
|
|
module.exports = {
|
|
|
root: true,
|
|
|
extends: [
|
|
|
@@ -13,13 +22,21 @@ module.exports = {
|
|
|
// `browser` is a local variable since we remove the global `chrome` and `browser` in injected*
|
|
|
// to prevent exposing them to userscripts with `@inject-into content`
|
|
|
files: ['*'],
|
|
|
- excludedFiles: [
|
|
|
- 'src/injected/**/*.js',
|
|
|
- 'src/common/*.js',
|
|
|
- ],
|
|
|
+ excludedFiles: unsafeEnvironment,
|
|
|
globals: {
|
|
|
browser: false,
|
|
|
},
|
|
|
+ }, {
|
|
|
+ files: unsafeEnvironment,
|
|
|
+ rules: {
|
|
|
+ /* Our .browserslistrc targets old browsers so the compiled code for {...objSpread} uses
|
|
|
+ babel's polyfill that calls methods like `Object.assign` instead of our safe `assign`.
|
|
|
+ Ideally, `eslint-plugin-compat` should be used but I couldn't make it work. */
|
|
|
+ 'no-restricted-syntax': ['error', {
|
|
|
+ selector: 'ObjectExpression > ExperimentalSpreadProperty',
|
|
|
+ message: 'Object spread in an unsafe environment',
|
|
|
+ }],
|
|
|
+ },
|
|
|
}],
|
|
|
rules: {
|
|
|
'import/extensions': ['error', 'ignorePackages', {
|