Skip to content

Instantly share code, notes, and snippets.

@remy
Created June 14, 2018 17:45
Show Gist options
  • Save remy/17a9779a8ff2a3dd67a8f24e162de14a to your computer and use it in GitHub Desktop.
Save remy/17a9779a8ff2a3dd67a8f24e162de14a to your computer and use it in GitHub Desktop.
module.exports = {
env: { browser: true, es6: true, commonjs: true },
extends: ['eslint:recommended', 'plugin:compat/recommended'],
parser: 'babel-eslint',
parserOptions: {
ecmaFeatures: { experimentalObjectRestSpread: true, jsx: true },
sourceType: 'module',
},
plugins: ['react'],
rules: {
'react/prop-types': 0,
'react/jsx-uses-vars': [2],
},
};
export default string => {
if (!string.startsWith('http')) {
// expecting error - but none
return false;
}
const url = new URL(string);
return Array.from(url.searchParams.entries()).reduce((acc, [key, value]) => {
acc[key] = value;
return acc;
}, {});
};
{
"name": "compat-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"babel-eslint": "^8.2.3",
"eslint": "^4.19.1",
"eslint-plugin-compat": "^2.4.0",
"eslint-plugin-react": "^7.9.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment