Fix and unify eslint

This commit is contained in:
nndio 2019-01-10 19:23:33 +02:00
parent 4d03f18bf7
commit 458f9019aa
112 changed files with 342 additions and 3241 deletions

1
.eslintcache Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,8 @@
node_modules *.log
build .idea
dev
dist
lib lib
dist
umd
build
coverage
node_modules

34
.eslintrc Normal file
View File

@ -0,0 +1,34 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"prettier"
],
"globals": {
"chrome": true
},
"env": {
"es6": true,
"browser": true,
"jest": true,
"node": true
},
"rules": {
"eol-last": ["warn"],
"max-len": ["warn", { "code": 120 , "ignoreComments": true }],
"quotes": ["warn", "single", "avoid-escape"],
"jsx-quotes": ["warn", "prefer-double"],
"react/prop-types": 0
},
"plugins": [
"prettier",
"react",
"babel"
],
"settings": {
"react": {
"version": "detect"
}
}
}

View File

@ -2,7 +2,10 @@
"private": true, "private": true,
"devDependencies": { "devDependencies": {
"babel-eslint": "^10.0.0", "babel-eslint": "^10.0.0",
"eslint-plugin-flowtype": "3.2.1", "eslint": "^5.12.0",
"eslint-config-prettier": "^3.3.0",
"eslint-plugin-babel": "^5.3.0",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-react": "7.12.3", "eslint-plugin-react": "7.12.3",
"jest": "^23.6.0", "jest": "^23.6.0",
"lerna": "3.9.0", "lerna": "3.9.0",
@ -15,8 +18,9 @@
"publish": "lerna publish", "publish": "lerna publish",
"canary": "lerna publish --canary preminor --npm-tag alpha", "canary": "lerna publish --canary preminor --npm-tag alpha",
"next": "lerna publish --bump prerelease --npm-tag next", "next": "lerna publish --bump prerelease --npm-tag next",
"lint": "lerna run lint --since master -- --color", "lint": "eslint '**/*.{js,jsx}' --cache",
"lint:all": "lerna run lint -- --color", "lint:fix": "eslint '**/*.{js,jsx}' --fix --cache",
"lint:all": "eslint '**/*.{js,jsx}'",
"test": "jest --onlyChanged", "test": "jest --onlyChanged",
"test:all": "jest" "test:all": "jest"
}, },

View File

@ -1,4 +0,0 @@
lib
**/node_modules
**/webpack.config.js
examples/**/server.js

View File

@ -1,16 +0,0 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
},
"rules": {
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2
},
"plugins": [
"react"
]
}

View File

@ -5,15 +5,13 @@
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
"clean": "rimraf lib dist", "clean": "rimraf lib dist",
"lint": "eslint src",
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"build:umd": "webpack --progress --config webpack.config.umd.js", "build:umd": "webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js", "build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"version": "npm run build", "version": "npm run build",
"postversion": "git push && git push --tags && npm run clean", "postversion": "git push && git push --tags && npm run clean",
"prepare": "npm run clean && npm run build", "prepare": "npm run clean && npm run build",
"prepublishOnly": "prepublishOnly": "npm run clean && npm run build && npm run build:umd && npm run build:umd:min"
"npm run lint && npm run clean && npm run build && npm run build:umd && npm run build:umd:min"
}, },
"files": [ "files": [
"lib", "lib",
@ -37,14 +35,10 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.26.0", "babel-cli": "^6.26.0",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-eslint": "^5.0.0-beta4",
"babel-loader": "^7.1.5", "babel-loader": "^7.1.5",
"babel-preset-es2015-loose": "^6.1.3", "babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "^0.24",
"eslint-config-airbnb": "0.0.6",
"eslint-plugin-react": "^3.6.3",
"rimraf": "^2.3.4", "rimraf": "^2.3.4",
"webpack": "^4.27.1", "webpack": "^4.27.1",
"webpack-cli": "^3.2.0" "webpack-cli": "^3.2.0"

View File

@ -1,20 +0,0 @@
{
"extends": "airbnb",
"rules": {
"arrow-body-style": 0,
"prefer-arrow-callback": 0,
"func-names": 0,
"comma-dangle": ["error", "never"],
"newline-per-chained-call": 0,
"react/sort-comp": 0,
"react/jsx-no-bind": 0,
"react/jsx-uses-react": 1,
"react/prefer-stateless-function": 0
},
"env": {
"browser": true,
"node": true,
"jest": true
},
"parser": "babel-eslint"
}

View File

@ -14,16 +14,13 @@
"scripts": { "scripts": {
"start": "npm run storybook", "start": "npm run storybook",
"build": "rimraf ./lib && babel ./src --out-dir ./lib --ignore tests,stories", "build": "rimraf ./lib && babel ./src --out-dir ./lib --ignore tests,stories",
"lint": "eslint src",
"lintfix": "eslint src --fix",
"lint:css": "stylelint './src/**/styles/*.js'", "lint:css": "stylelint './src/**/styles/*.js'",
"format": "prettier-eslint --write ./src/**/*.js",
"test:update": "npm run jest -- -u", "test:update": "npm run jest -- -u",
"test": "jest --no-cache", "test": "jest --no-cache",
"storybook": "start-storybook -p 9001 -c .storybook -s ./fonts", "storybook": "start-storybook -p 9001 -c .storybook -s ./fonts",
"publish-storybook": "bash .scripts/publish_storybook.sh", "publish-storybook": "bash .scripts/publish_storybook.sh",
"prepare": "npm run build", "prepare": "npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run build" "prepublishOnly": "npm run test && npm run build"
}, },
"bugs": { "bugs": {
"url": "https://github.com/reduxjs/redux-devtools/issues" "url": "https://github.com/reduxjs/redux-devtools/issues"
@ -37,7 +34,6 @@
"@storybook/react": "4.0.9", "@storybook/react": "4.0.9",
"babel-cli": "^6.26.0", "babel-cli": "^6.26.0",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-eslint": "^6.0.2",
"babel-jest": "^21.2.0", "babel-jest": "^21.2.0",
"babel-loader": "^7.1.2", "babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0",
@ -48,15 +44,9 @@
"enzyme": "^3.1.0", "enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2", "enzyme-adapter-react-16": "^1.0.2",
"enzyme-to-json": "^3.1.4", "enzyme-to-json": "^3.1.4",
"eslint": "^2.7.0",
"eslint-config-airbnb": "^7.0.0",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-jsx-a11y": "^0.6.2",
"eslint-plugin-react": "^4.3.0",
"git-url-parse": "^7.0.1", "git-url-parse": "^7.0.1",
"jest": "^23.6.0", "jest": "^23.6.0",
"jsdom": "^11.3.0", "jsdom": "^11.3.0",
"prettier-eslint-cli": "^4.4.0",
"react": "^16.0.0", "react": "^16.0.0",
"react-addons-test-utils": "^15.6.2", "react-addons-test-utils": "^15.6.2",
"react-dom": "^16.0.0", "react-dom": "^16.0.0",

View File

@ -12,7 +12,6 @@ storiesOf('Dialog', module)
() => ( () => (
<Dialog <Dialog
title={text('title', 'Dialog Title')} title={text('title', 'Dialog Title')}
children={text('children', 'Hello Dialog!')}
submitText={text('submitText', 'Submit!')} submitText={text('submitText', 'Submit!')}
open={boolean('open', true)} open={boolean('open', true)}
noHeader={boolean('noHeader', false)} noHeader={boolean('noHeader', false)}
@ -21,7 +20,9 @@ storiesOf('Dialog', module)
fullWidth={boolean('fullWidth', false)} fullWidth={boolean('fullWidth', false)}
onDismiss={action('dialog dismissed')} onDismiss={action('dialog dismissed')}
onSubmit={action('dialog submitted')} onSubmit={action('dialog submitted')}
/> >
{text('children', 'Hello Dialog!')}
</Dialog>
) )
) )
.add( .add(

View File

@ -1,4 +0,0 @@
lib
**/node_modules
**/webpack.config.js
examples/**/server.js

View File

@ -1,13 +0,0 @@
{
"extends": "eslint:recommended",
"env": {
"browser": true,
"node": true,
"jest": true
},
"globals": {
"test": true,
"expect": true
},
"parser": "babel-eslint"
}

View File

@ -8,11 +8,9 @@
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"build:umd": "webpack --progress --config webpack.config.umd.js", "build:umd": "webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js", "build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"lint": "eslint src test",
"test": "jest", "test": "jest",
"check": "npm run lint && npm run test",
"prepare": "npm run build && npm run build:umd", "prepare": "npm run build && npm run build:umd",
"prepublishOnly": "npm run check && npm run clean && npm run build && npm run build:umd && npm run build:umd:min" "prepublishOnly": "npm run test && npm run clean && npm run build && npm run build:umd && npm run build:umd:min"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -34,12 +32,10 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.26.0", "babel-cli": "^6.26.0",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-eslint": "4.1.8",
"babel-loader": "^6.2.0", "babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3", "babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "1.10.3",
"immutable": "3.7.6", "immutable": "3.7.6",
"jest": "^23.6.0", "jest": "^23.6.0",
"rimraf": "^2.3.4", "rimraf": "^2.3.4",

View File

@ -1,5 +0,0 @@
lib
**/node_modules
**/webpack.config.js
examples/**/server.js
examples/src/App.js

View File

@ -1,53 +0,0 @@
{
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"standard",
"plugin:react/recommended",
"prettier"
],
"env": {
"browser": true,
"jest": true,
"node": true
},
"rules": {
"no-restricted-syntax": 0,
"comma-dangle": 0,
"no-param-reassign": 0,
"space-infix-ops": 0,
"react/sort-comp": [
1, {
"order": [
"static-methods",
"constructor",
"lifecycle",
"everything-else",
"render",
"/^handle.+$/"
],
"groups": {
"lifecycle": [
"childContextTypes",
"getInitialState",
"state",
"getChildContext",
"componentWillMount",
"componentDidMount",
"componentWillReceiveProps",
"shouldComponentUpdate",
"componentWillUpdate",
"componentDidUpdate",
"componentWillUnmount"
]
}
}
]
},
"plugins": [
"prettier",
"standard",
"react",
"babel"
]
}

View File

@ -1,25 +0,0 @@
{
"extends": [
"eslint:recommended",
"standard",
"plugin:react/recommended",
"prettier"
],
"env": {
"browser": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"quotes": [2, "single"],
"strict": [2, "never"],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2
},
"plugins": [
"prettier",
"standard",
"react"
]
}

View File

@ -4,7 +4,6 @@
"description": "React-Json-Tree example", "description": "React-Json-Tree example",
"scripts": { "scripts": {
"start": "node server.js", "start": "node server.js",
"lint": "eslint src",
"stats": "NODE_ENV=production webpack --json > dist/stats.json" "stats": "NODE_ENV=production webpack --json > dist/stats.json"
}, },
"repository": { "repository": {
@ -29,16 +28,10 @@
"homepage": "https://github.com/gaearon/react-hot-boilerplate", "homepage": "https://github.com/gaearon/react-hot-boilerplate",
"devDependencies": { "devDependencies": {
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.2", "babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-react": "^6.5.0", "babel-preset-react": "^6.5.0",
"eslint": "^4.10.0",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"webpack": "^3.8.1", "webpack": "^3.8.1",
"webpack-dev-server": "^2.4.1" "webpack-dev-server": "^2.4.1"
}, },

View File

@ -1,3 +1,4 @@
/* eslint-disable no-console */
var webpack = require('webpack'); var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server'); var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config'); var config = require('./webpack.config');
@ -6,7 +7,7 @@ new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath, publicPath: config.output.publicPath,
hot: true, hot: true,
historyApiFallback: true historyApiFallback: true
}).listen(3000, 'localhost', function (err, result) { }).listen(3000, 'localhost', function (err) {
if (err) { if (err) {
console.log(err); console.log(err);
} }

View File

@ -34,9 +34,8 @@ const getValueLabelStyle = ({ style }, nodeType, keyPath) => ({
} }
}); });
// eslint-disable-next-line max-len
const longString = const longString =
'Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor.Maecenasodiolectus,finibusegetultricesvel,aliquamutelit.Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor.Maecenasodiolectus,finibusegetultricesvel,aliquamutelit.Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor.Maecenasodiolectus,finibusegetultricesvel,aliquamutelit.'; 'Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor.Maecenasodiolectus,finibusegetultricesvel,aliquamutelit.Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor.Maecenasodiolectus,finibusegetultricesvel,aliquamutelit.Loremipsumdolorsitamet,consecteturadipiscingelit.Namtempusipsumutfelisdignissimauctor.Maecenasodiolectus,finibusegetultricesvel,aliquamutelit.'; // eslint-disable-line max-len
const Custom = function(value) { const Custom = function(value) {
this.value = value; this.value = value;

View File

@ -8,13 +8,10 @@
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"build:umd": "rimraf ./umd && webpack --progress --config webpack.config.umd.js", "build:umd": "rimraf ./umd && webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js", "build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"lint": "eslint --max-warnings=0 src test examples/src",
"test": "jest", "test": "jest",
"prepare": "npm run build", "prepare": "npm run build",
"prepublishOnly": "prepublishOnly": "npm run test && npm run clean && npm run build && npm run build:umd && npm run build:umd:min",
"npm run lint && npm run test && npm run clean && npm run build && npm run build:umd && npm run build:umd:min", "start": "cd examples && npm start"
"start": "cd examples && npm start",
"precommit": "lint-staged"
}, },
"files": [ "files": [
"lib", "lib",
@ -41,7 +38,6 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.26.0", "babel-cli": "^6.26.0",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.5", "babel-loader": "^7.1.5",
"babel-plugin-transform-class-properties": "^6.24.1", "babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0", "babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
@ -50,20 +46,8 @@
"babel-plugin-transform-runtime": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.5.0", "babel-preset-react": "^6.5.0",
"eslint": "^4.10",
"eslint-config-prettier": "^2.6.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-node": "^5.2.1",
"eslint-plugin-prettier": "^2.3.1",
"eslint-plugin-promise": "^3.6.0",
"eslint-plugin-react": "7.4.0",
"eslint-plugin-standard": "^3.0.1",
"husky": "^0.14.3", "husky": "^0.14.3",
"jest": "^23.6.0", "jest": "^23.6.0",
"lint-staged": "^4.3.0",
"prettier": "^1.7.4",
"react": "^16.0.0", "react": "^16.0.0",
"react-dom": "^16.0.0", "react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0", "react-test-renderer": "^16.0.0",
@ -80,8 +64,5 @@
"babel-runtime": "^6.6.1", "babel-runtime": "^6.6.1",
"prop-types": "^15.5.8", "prop-types": "^15.5.8",
"react-base16-styling": "^0.5.1" "react-base16-styling": "^0.5.1"
},
"lint-staged": {
"*.{js,json,css}": ["prettier --single-quote --write", "git add"]
} }
} }

View File

@ -86,7 +86,7 @@ const JSONNode = ({
return <JSONValueNode {...simpleNodeProps} />; return <JSONValueNode {...simpleNodeProps} />;
default: default:
return ( return (
<JSONValueNode {...simpleNodeProps} valueGetter={raw => `<${nodeType}>`} /> <JSONValueNode {...simpleNodeProps} valueGetter={() => `<${nodeType}>`} />
); );
} }
}; };

View File

@ -10,6 +10,7 @@ function open(app, options) {
[path.join(__dirname, '..', 'app')] [path.join(__dirname, '..', 'app')]
); );
} catch (error) { } catch (error) {
/* eslint-disable no-console */
if (error.message === 'Cannot find module \'electron\'') { if (error.message === 'Cannot find module \'electron\'') {
// TODO: Move electron to dev-dependences to make our package installation faster when not needed. // TODO: Move electron to dev-dependences to make our package installation faster when not needed.
console.log(' \x1b[1;31m[Warn]\x1b[0m Electron module not installed.\n'); console.log(' \x1b[1;31m[Warn]\x1b[0m Electron module not installed.\n');
@ -21,6 +22,7 @@ function open(app, options) {
} else { } else {
console.log(error); console.log(error);
} }
/* eslint-enable no-console */
} }
return; return;
} }

View File

@ -22,7 +22,7 @@ if (argv.protocol === 'https') {
function log(pass, msg) { function log(pass, msg) {
var prefix = pass ? chalk.green.bgBlack('PASS') : chalk.red.bgBlack('FAIL'); var prefix = pass ? chalk.green.bgBlack('PASS') : chalk.red.bgBlack('FAIL');
var color = pass ? chalk.blue : chalk.red; var color = pass ? chalk.blue : chalk.red;
console.log(prefix, color(msg)); console.log(prefix, color(msg)); // eslint-disable-line no-console
} }
function getModuleName(type) { function getModuleName(type) {
@ -55,22 +55,20 @@ function getModule(type) {
}; };
} }
if (argv.revert) { function injectRN(type, msg) {
var module = getModule(argv.revert); var module = getModule(type);
var pass = injectServer.revert(module.path, module.name); var fn = type === 'revert' ? injectServer.revert : injectServer.inject;
var msg = 'Revert injection of ReduxDevTools server from React Native local server'; var pass = fn(module.path, options, module.name);
log(pass, msg + (!pass ? ', the file `' + path.join(module.name, injectServer.fullPath) + '` not found.' : '.')); log(pass, msg + (pass ? '.' : ', the file `' + path.join(module.name, injectServer.fullPath) + '` not found.'));
process.exit(pass ? 0 : 1); process.exit(pass ? 0 : 1);
} }
if (argv.revert) {
injectRN(argv.revert, 'Revert injection of ReduxDevTools server from React Native local server');
}
if (argv.injectserver) { if (argv.injectserver) {
var module = getModule(argv.injectserver); injectRN(argv.injectserver, 'Inject ReduxDevTools server into React Native local server');
var pass = injectServer.inject(module.path, options, module.name);
var msg = 'Inject ReduxDevTools server into React Native local server';
log(pass, msg + (pass ? '.' : ', the file `' + path.join(module.name, injectServer.fullPath) + '` not found.'));
process.exit(pass ? 0 : 1);
} }
server(argv).then(function (r) { server(argv).then(function (r) {

View File

@ -2,7 +2,7 @@ var getPort = require('getport');
var SocketCluster = require('socketcluster'); var SocketCluster = require('socketcluster');
var getOptions = require('./src/options'); var getOptions = require('./src/options');
var LOG_LEVEL_NONE = 0; // var LOG_LEVEL_NONE = 0;
var LOG_LEVEL_ERROR = 1; var LOG_LEVEL_ERROR = 1;
var LOG_LEVEL_WARN = 2; var LOG_LEVEL_WARN = 2;
var LOG_LEVEL_INFO = 3; var LOG_LEVEL_INFO = 3;
@ -17,6 +17,7 @@ module.exports = function(argv) {
return new Promise(function(resolve) { return new Promise(function(resolve) {
// Check port already used // Check port already used
getPort(port, function(err, p) { getPort(port, function(err, p) {
/* eslint-disable no-console */
if (err) { if (err) {
if (logLevel >= LOG_LEVEL_ERROR) { if (logLevel >= LOG_LEVEL_ERROR) {
console.error(err); console.error(err);
@ -35,6 +36,7 @@ module.exports = function(argv) {
} }
resolve(new SocketCluster(options)); resolve(new SocketCluster(options));
} }
/* eslint-enable no-console */
}); });
}); });
}; };

View File

@ -4,10 +4,10 @@ var schema = requireSchema('./schema_def.graphql', require);
var resolvers = { var resolvers = {
Query: { Query: {
reports: function report(source, args, context, ast) { reports: function report(source, args, context) {
return context.store.listAll(); return context.store.listAll();
}, },
report: function report(source, args, context, ast) { report: function report(source, args, context) {
return context.store.get(args.id); return context.store.get(args.id);
} }
} }

View File

@ -12,6 +12,7 @@ module.exports = function connector(options) {
dbOptions.seeds = { directory: path.resolve(__dirname, 'seeds') }; dbOptions.seeds = { directory: path.resolve(__dirname, 'seeds') };
var knex = knexModule(dbOptions); var knex = knexModule(dbOptions);
/* eslint-disable no-console */
knex.migrate.latest() knex.migrate.latest()
.then(function() { .then(function() {
return knex.seed.run(); return knex.seed.run();
@ -22,6 +23,7 @@ module.exports = function connector(options) {
.catch(function(error) { .catch(function(error) {
console.error(error); console.error(error);
}); });
/* eslint-enable no-console */
return knex; return knex;
}; };

View File

@ -47,7 +47,7 @@ function routes(options, store, scServer) {
store.get(req.body.id).then(function (r) { store.get(req.body.id).then(function (r) {
res.send(r || {}); res.send(r || {});
}).catch(function (error) { }).catch(function (error) {
console.error(error); console.error(error); // eslint-disable-line no-console
res.sendStatus(500) res.sendStatus(500)
}); });
break; break;
@ -55,7 +55,7 @@ function routes(options, store, scServer) {
store.list(req.body.query, req.body.fields).then(function (r) { store.list(req.body.query, req.body.fields).then(function (r) {
res.send(r); res.send(r);
}).catch(function (error) { }).catch(function (error) {
console.error(error); console.error(error); // eslint-disable-line no-console
res.sendStatus(500) res.sendStatus(500)
}); });
break; break;
@ -66,7 +66,7 @@ function routes(options, store, scServer) {
type: 'add', data: r type: 'add', data: r
}); });
}).catch(function (error) { }).catch(function (error) {
console.error(error); console.error(error); // eslint-disable-line no-console
res.status(500).send({}) res.status(500).send({})
}); });
} }

View File

@ -9,7 +9,7 @@ var knex;
var baseFields = ['id', 'title', 'added']; var baseFields = ['id', 'title', 'added'];
function error(msg) { function error(msg) {
return new Promise(function(resolve, reject) { return new Promise(function(resolve) {
return resolve({ error: msg }); return resolve({ error: msg });
}); });
} }

View File

@ -1,4 +1,4 @@
var SCWorker = require("socketcluster/scworker"); var SCWorker = require('socketcluster/scworker');
var express = require('express'); var express = require('express');
var app = express(); var app = express();
var routes = require('./routes'); var routes = require('./routes');
@ -32,7 +32,7 @@ class Worker extends SCWorker {
store.list().then(function (data) { store.list().then(function (data) {
req.socket.emit(req.channel, {type: 'list', data: data}); req.socket.emit(req.channel, {type: 'list', data: data});
}).catch(function (error) { }).catch(function (error) {
console.error(error); console.error(error); // eslint-disable-line no-console
}); });
} }
}); });
@ -56,7 +56,7 @@ class Worker extends SCWorker {
store.get(id).then(function (data) { store.get(id).then(function (data) {
respond(null, data); respond(null, data);
}).catch(function (error) { }).catch(function (error) {
console.error(error); console.error(error); // eslint-disable-line no-console
}); });
}); });
socket.on('disconnect', function () { socket.on('disconnect', function () {

View File

@ -41,12 +41,12 @@ describe('Server', function() {
socket = scClient.connect({ hostname: 'localhost', port: 8000 }); socket = scClient.connect({ hostname: 'localhost', port: 8000 });
socket.connect(); socket.connect();
socket.on('error', function(error) { socket.on('error', function(error) {
console.error('Socket1 error', error); console.error('Socket1 error', error); // eslint-disable-line no-console
}); });
socket2 = scClient.connect({ hostname: 'localhost', port: 8000 }); socket2 = scClient.connect({ hostname: 'localhost', port: 8000 });
socket2.connect(); socket2.connect();
socket.on('error', function(error) { socket.on('error', function(error) {
console.error('Socket2 error', error); console.error('Socket2 error', error); // eslint-disable-line no-console
}); });
}); });
@ -64,7 +64,7 @@ describe('Server', function() {
it('should login', function() { it('should login', function() {
socket.emit('login', 'master', function(error, channelName) { socket.emit('login', 'master', function(error, channelName) {
if (error) { console.log(error); return; } if (error) { console.log(error); return; } // eslint-disable-line no-console
expect(channelName).toBe('respond'); expect(channelName).toBe('respond');
channel = socket.subscribe(channelName); channel = socket.subscribe(channelName);
expect(channel.SUBSCRIBED).toBe('subscribed'); expect(channel.SUBSCRIBED).toBe('subscribed');
@ -73,24 +73,24 @@ describe('Server', function() {
it('should send message', function(done) { it('should send message', function(done) {
var data = { var data = {
"type": "ACTION", 'type': 'ACTION',
"payload": { 'payload': {
"todos": "do some" 'todos': 'do some'
}, },
"action": { 'action': {
"timestamp": 1483349708506, 'timestamp': 1483349708506,
"action": { 'action': {
"type": "ADD_TODO", 'type': 'ADD_TODO',
"text": "hggg" 'text': 'hggg'
} }
}, },
"instanceId": "tAmA7H5fclyWhvizAAAi", 'instanceId': 'tAmA7H5fclyWhvizAAAi',
"name": "LoggerInstance", 'name': 'LoggerInstance',
"id": "tAmA7H5fclyWhvizAAAi" 'id': 'tAmA7H5fclyWhvizAAAi'
}; };
socket2.emit('login', '', function(error, channelName) { socket2.emit('login', '', function(error, channelName) {
if (error) { console.log(error); return; } if (error) { console.log(error); return; } // eslint-disable-line no-console
expect(channelName).toBe('log'); expect(channelName).toBe('log');
var channel2 = socket2.subscribe(channelName); var channel2 = socket2.subscribe(channelName);
expect(channel2.SUBSCRIBED).toBe('subscribed'); expect(channel2.SUBSCRIBED).toBe('subscribed');
@ -114,7 +114,8 @@ describe('Server', function() {
action: 'SOME_FINAL_ACTION', action: 'SOME_FINAL_ACTION',
payload: '[{"type":"ADD_TODO","text":"hi"},{"type":"SOME_FINAL_ACTION"}]', payload: '[{"type":"ADD_TODO","text":"hi"},{"type":"SOME_FINAL_ACTION"}]',
preloadedState: '{"todos":[{"text":"Use Redux","completed":false,"id":0}]}', preloadedState: '{"todos":[{"text":"Use Redux","completed":false,"id":0}]}',
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36' userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) ' +
'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36'
}; };
it('should add a report', function(done) { it('should add a report', function(done) {
request('http://localhost:8000') request('http://localhost:8000')

View File

@ -1,53 +0,0 @@
{
"extends": "eslint-config-airbnb",
"globals": {
"chrome": true
},
"env": {
"jest": true,
"browser": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"react/prefer-stateless-function": 0,
"react/no-array-index-key": 0,
"react/forbid-prop-types": 0,
"react/require-default-props": 0,
"react/jsx-filename-extension": 0,
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"react/sort-comp": 0,
"react/jsx-quotes": 0,
"import/no-extraneous-dependencies": 0,
"block-scoped-var": 0,
"padded-blocks": 0,
"quotes": [ 1, "single" ],
"comma-style": [ 2, "last" ],
"eol-last": 0,
"no-unused-vars": 0,
"no-console": 0,
"func-names": 0,
"prefer-const": 0,
"comma-dangle": 0,
"id-length": 0,
"no-use-before-define": 0,
"indent": [2, 2, {"SwitchCase": 1}],
"new-cap": [2, { "capIsNewExceptions": ["Test"] }],
"no-underscore-dangle": 0,
"no-plusplus": 0,
"no-proto": 0,
"arrow-parens": 0,
"prefer-arrow-callback": 0,
"prefer-rest-params": 0,
"prefer-template": 0,
"class-methods-use-this": 0,
"max-len": ["error", { "code": 120 }],
"no-mixed-operators": 0,
"no-undef": 0
},
"plugins": [
"react"
]
}

View File

@ -10,7 +10,7 @@ render(
if (module.hot) { if (module.hot) {
// https://github.com/webpack/webpack/issues/418#issuecomment-53398056 // https://github.com/webpack/webpack/issues/418#issuecomment-53398056
module.hot.accept(err => { module.hot.accept(err => {
if (err) console.error(err.message); if (err) console.error(err.message); // eslint-disable-line no-console
}); });
/* /*

View File

@ -9,11 +9,9 @@
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js", "build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"build": "rimraf ./lib && babel ./src/app --out-dir lib", "build": "rimraf ./lib && babel ./src/app --out-dir lib",
"clean": "rimraf lib", "clean": "rimraf lib",
"lint": "eslint src test",
"lint:fix": "eslint src --fix",
"test": "jest --no-cache", "test": "jest --no-cache",
"prepare": "npm run build && npm run build:umd && npm run build:umd:min", "prepare": "npm run build && npm run build:umd && npm run build:umd:min",
"prepublishOnly": "eslint ./src/app && npm run test && npm run build && npm run build:umd && npm run build:umd:min" "prepublishOnly": "npm run test && npm run build && npm run build:umd && npm run build:umd:min"
}, },
"main": "lib/index.js", "main": "lib/index.js",
"files": [ "files": [
@ -40,7 +38,6 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.26.0", "babel-cli": "^6.26.0",
"babel-core": "^6.26.3", "babel-core": "^6.26.3",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.5", "babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-transform": "^2.0.2", "babel-plugin-react-transform": "^2.0.2",
@ -55,11 +52,6 @@
"enzyme": "^3.1.0", "enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2", "enzyme-adapter-react-16": "^1.0.2",
"enzyme-to-json": "^3.1.4", "enzyme-to-json": "^3.1.4",
"eslint": "^3.15.0",
"eslint-config-airbnb": "^14.1.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.9.0",
"file-loader": "^3.0.0", "file-loader": "^3.0.0",
"html-loader": "^0.4.4", "html-loader": "^0.4.4",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Button, Toolbar, Divider, Spacer } from 'devui'; import { Button, Toolbar, Divider } from 'devui';
import SaveIcon from 'react-icons/lib/md/save'; import SaveIcon from 'react-icons/lib/md/save';
import ExportButton from './buttons/ExportButton'; import ExportButton from './buttons/ExportButton';
import ImportButton from './buttons/ImportButton'; import ImportButton from './buttons/ImportButton';
@ -16,7 +16,7 @@ export default class BottomButtons extends Component {
options: PropTypes.object.isRequired options: PropTypes.object.isRequired
}; };
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps) {
return nextProps.dispatcherIsOpen !== this.props.dispatcherIsOpen return nextProps.dispatcherIsOpen !== this.props.dispatcherIsOpen
|| nextProps.sliderIsOpen !== this.props.sliderIsOpen || nextProps.sliderIsOpen !== this.props.sliderIsOpen
|| nextProps.options !== this.props.options; || nextProps.options !== this.props.options;

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Tabs, Toolbar, Button, Divider, Spacer } from 'devui'; import { Tabs, Toolbar, Button, Divider } from 'devui';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import DocsIcon from 'react-icons/lib/go/book'; import DocsIcon from 'react-icons/lib/go/book';

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Container, Form, Button } from 'devui'; import { Container, Form } from 'devui';
import { saveSocketSettings } from '../../actions'; import { saveSocketSettings } from '../../actions';
const defaultSchema = { const defaultSchema = {

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Container, Form, Button } from 'devui'; import { Container, Form } from 'devui';
import { listSchemes, listThemes } from 'devui/lib/utils/theme'; import { listSchemes, listThemes } from 'devui/lib/utils/theme';
import { changeTheme } from '../../actions'; import { changeTheme } from '../../actions';

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Tabs } from 'devui'; import { Tabs } from 'devui';
import Connection from './Connection'; import Connection from './Connection';
import Themes from './Themes'; import Themes from './Themes';

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { ActionCreators } from 'redux-devtools-instrument'; import { ActionCreators } from 'redux-devtools-instrument';
import { Button, Toolbar, Divider, Spacer } from 'devui'; import { Button, Toolbar, Divider } from 'devui';
import RecordButton from './buttons/RecordButton'; import RecordButton from './buttons/RecordButton';
import PersistButton from './buttons/PersistButton'; import PersistButton from './buttons/PersistButton';
import LockButton from './buttons/LockButton'; import LockButton from './buttons/LockButton';

View File

@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { bindActionCreators } from 'redux'; import { bindActionCreators } from 'redux';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { Button } from 'devui'; import { Button } from 'devui';
import { stringify } from 'jsan';
import DownloadIcon from 'react-icons/lib/ti/download'; import DownloadIcon from 'react-icons/lib/ti/download';
import { exportState } from '../../actions'; import { exportState } from '../../actions';

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Button } from 'devui'; import { Button } from 'devui';
import PrintIcon from 'react-icons/lib/md/print'; import PrintIcon from 'react-icons/lib/md/print';

View File

@ -1,4 +1,4 @@
import React, { Component, createElement } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { withTheme } from 'styled-components'; import { withTheme } from 'styled-components';
import getMonitor from '../utils/getMonitor'; import getMonitor from '../utils/getMonitor';

View File

@ -167,7 +167,7 @@ class Dispatcher extends Component {
let options = [{ value: 'default', label: 'Custom action' }]; let options = [{ value: 'default', label: 'Custom action' }];
if (actionCreators && actionCreators.length > 0) { if (actionCreators && actionCreators.length > 0) {
options = options.concat(actionCreators.map(({ name, func, args }, i) => ({ options = options.concat(actionCreators.map(({ name, args }, i) => ({
value: i, value: i,
label: `${name}(${args.join(', ')})` label: `${name}(${args.join(', ')})`
}))); })));

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Editor } from 'devui'; import { Editor } from 'devui';
import stringify from 'javascript-stringify'; import stringify from 'javascript-stringify';

View File

@ -1,4 +1,4 @@
import React, { Component, createElement } from 'react'; import React, { Component } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import styled, { withTheme } from 'styled-components'; import styled, { withTheme } from 'styled-components';
import SliderMonitor from 'redux-slider-monitor'; import SliderMonitor from 'redux-slider-monitor';

View File

@ -1,5 +1,5 @@
import { import {
MONITOR_ACTION, SELECT_MONITOR, SELECT_MONITOR_TAB, UPDATE_MONITOR_STATE, MONITOR_ACTION, SELECT_MONITOR, UPDATE_MONITOR_STATE,
TOGGLE_SLIDER, TOGGLE_DISPATCHER TOGGLE_SLIDER, TOGGLE_DISPATCHER
} from '../constants/actionTypes'; } from '../constants/actionTypes';

View File

@ -1,4 +1,4 @@
import { UPDATE_REPORTS, GET_REPORT_SUCCESS } from '../constants/actionTypes'; import { UPDATE_REPORTS /* , GET_REPORT_SUCCESS */ } from '../constants/actionTypes';
const initialState = { const initialState = {
data: [] data: []

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react'; import React from 'react';
import PropTypes from 'prop-types';
import LogMonitor from 'redux-devtools-log-monitor'; import LogMonitor from 'redux-devtools-log-monitor';
import ChartMonitorWrapper from '../containers/monitors/ChartMonitorWrapper'; import ChartMonitorWrapper from '../containers/monitors/ChartMonitorWrapper';
import InspectorWrapper from '../containers/monitors/InspectorWrapper'; import InspectorWrapper from '../containers/monitors/InspectorWrapper';

View File

@ -28,6 +28,7 @@ export default function parseJSON(data, serialize) {
try { try {
return serialize ? jsan.parse(data, reviver) : jsan.parse(data); return serialize ? jsan.parse(data, reviver) : jsan.parse(data);
} catch (e) { } catch (e) {
/* eslint-disable-next-line no-console */
if (process.env.NODE_ENV !== 'production') console.error(data + 'is not a valid JSON', e); if (process.env.NODE_ENV !== 'production') console.error(data + 'is not a valid JSON', e);
return undefined; return undefined;
} }

View File

@ -1,6 +1,6 @@
function injectedScript() { function injectedScript() {
console.error('Not implemented yet. WIP. If you\'re looking for utils, ' + /* eslint-disable-next-line no-console */
'import `redux-devtools-core/lib/utils`.'); console.error('Not implemented yet. WIP. If you\'re looking for utils, import `redux-devtools-core/lib/utils`.');
} }
export default injectedScript; export default injectedScript;

View File

@ -14,6 +14,7 @@ export default function catchErrors(sendError) {
}); });
} }
/* eslint-disable no-console */
if ( if (
typeof console === 'object' && typeof console.error === 'function' && !console.beforeRemotedev typeof console === 'object' && typeof console.error === 'function' && !console.beforeRemotedev
) { ) {
@ -32,4 +33,5 @@ export default function catchErrors(sendError) {
console.beforeRemotedev.apply(null, arguments); console.beforeRemotedev.apply(null, arguments);
}; };
} }
/* eslint-enable no-console */
} }

View File

@ -1,57 +0,0 @@
{
"parser": "babel-eslint",
"rules": {
"no-undef": ["error"],
"no-trailing-spaces": ["warn"],
"space-before-blocks": ["warn", "always"],
"no-unused-expressions": ["off"],
"no-underscore-dangle": ["off"],
"quote-props": ["warn", "as-needed"],
"no-multi-spaces": ["off"],
"no-unused-vars": ["warn"],
"no-loop-func": ["off"],
"key-spacing": ["off"],
"max-len": ["warn", 100],
"strict": ["off"],
"eol-last": ["warn"],
"no-console": ["warn"],
"indent": ["warn", 2],
"quotes": ["warn", "single", "avoid-escape"],
"curly": ["off"],
"jsx-quotes": ["warn", "prefer-single"],
"react/jsx-boolean-value": "warn",
"react/jsx-no-undef": "error",
"react/jsx-uses-react": "warn",
"react/jsx-uses-vars": "warn",
"react/no-did-mount-set-state": "warn",
"react/no-did-update-set-state": "warn",
"react/no-multi-comp": "off",
"react/no-unknown-property": "error",
"react/react-in-jsx-scope": "error",
"react/self-closing-comp": "warn",
"react/jsx-wrap-multilines": "warn",
"generator-star-spacing": "off",
"new-cap": "off",
"object-curly-spacing": "off",
"object-shorthand": "off",
"babel/generator-star-spacing": "warn",
"babel/new-cap": "warn",
"babel/object-curly-spacing": ["warn", "always"],
"babel/object-shorthand": "warn"
},
"plugins": [
"react",
"babel"
],
"settings": {
"ecmascript": 6,
"jsx": true
},
"env": {
"browser": true,
"node": true
}
}

View File

@ -100,7 +100,7 @@ class DemoApp extends React.Component {
value={options.theme} value={options.theme}
onSelect={value => this.setTheme(options, value)} onSelect={value => this.setTheme(options, value)}
optionFilters={[]}> optionFilters={[]}>
{props => <FormControl {...props} type='text' />} {props => <FormControl {...props} type="text" />}
</Combobox> </Combobox>
<InputGroup.Addon> <InputGroup.Addon>
<a onClick={this.toggleTheme} <a onClick={this.toggleTheme}

View File

@ -33,9 +33,9 @@ const CustomComponent = () =>
const getDevTools = options => const getDevTools = options =>
createDevTools( createDevTools(
<DockMonitor defaultIsVisible <DockMonitor defaultIsVisible
toggleVisibilityKey='ctrl-h' toggleVisibilityKey="ctrl-h"
changePositionKey='ctrl-q' changePositionKey="ctrl-q"
changeMonitorKey='ctrl-m'> changeMonitorKey="ctrl-m">
<DevtoolsInspector theme={options.theme} <DevtoolsInspector theme={options.theme}
shouldPersistState shouldPersistState
invertTheme={!options.dark} invertTheme={!options.dark}

View File

@ -8,13 +8,11 @@
"build:demo": "cross-env NODE_ENV=production webpack -p", "build:demo": "cross-env NODE_ENV=production webpack -p",
"stats": "webpack --profile --json > stats.json", "stats": "webpack --profile --json > stats.json",
"start": "webpack-dev-server", "start": "webpack-dev-server",
"lint": "eslint --ext .jsx,.js --max-warnings 0 src",
"preversion": "npm run lint", "preversion": "npm run lint",
"version": "npm run build:demo && git add -A .", "version": "npm run build:demo && git add -A .",
"postversion": "git push", "postversion": "git push",
"prepublish": "npm run build:lib",
"prepare": "npm run build:lib", "prepare": "npm run build:lib",
"prepublishOnly": "npm run lint && npm run build:lib", "prepublishOnly": "npm run build:lib",
"gh": "git subtree push --prefix demo/dist origin gh-pages" "gh": "git subtree push --prefix demo/dist origin gh-pages"
}, },
"main": "lib/index.js", "main": "lib/index.js",
@ -25,7 +23,6 @@
"babel": "^6.3.26", "babel": "^6.3.26",
"babel-cli": "^6.4.5", "babel-cli": "^6.4.5",
"babel-core": "^6.4.5", "babel-core": "^6.4.5",
"babel-eslint": "^7.1.0",
"babel-loader": "^7.1.5", "babel-loader": "^7.1.5",
"babel-plugin-react-transform": "^2.0.0", "babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-runtime": "^6.4.3", "babel-plugin-transform-runtime": "^6.4.3",
@ -36,10 +33,6 @@
"chokidar": "^1.6.1", "chokidar": "^1.6.1",
"clean-webpack-plugin": "^1.0.0", "clean-webpack-plugin": "^1.0.0",
"cross-env": "^5.2.0", "cross-env": "^5.2.0",
"eslint": "^4.0.0",
"eslint-loader": "^1.2.1",
"eslint-plugin-babel": "^4.0.0",
"eslint-plugin-react": "^6.6.0",
"export-files-webpack-plugin": "0.0.1", "export-files-webpack-plugin": "0.0.1",
"html-webpack-plugin": "^3.2.0", "html-webpack-plugin": "^3.2.0",
"lodash.shuffle": "^4.2.0", "lodash.shuffle": "^4.2.0",

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import dragula from 'react-dragula'; import dragula from 'react-dragula';
import ActionListRow from './ActionListRow'; import ActionListRow from './ActionListRow';
import ActionListHeader from './ActionListHeader'; import ActionListHeader from './ActionListHeader';
@ -35,7 +34,7 @@ export default class ActionList extends Component {
this.scrollToBottom(); this.scrollToBottom();
if (!this.props.draggableActions) return; if (!this.props.draggableActions) return;
const container = ReactDOM.findDOMNode(this.refs.rows); const container = this.node;
this.drake = dragula([container], { this.drake = dragula([container], {
copy: false, copy: false,
copySortSource: false, copySortSource: false,
@ -85,7 +84,7 @@ export default class ActionList extends Component {
) : actionIds; ) : actionIds;
return ( return (
<div key='actionList' <div key="actionList"
{...styling(['actionList', isWideLayout && 'actionListWide'], isWideLayout)}> {...styling(['actionList', isWideLayout && 'actionListWide'], isWideLayout)}>
<ActionListHeader styling={styling} <ActionListHeader styling={styling}
onSearch={onSearch} onSearch={onSearch}

View File

@ -14,7 +14,7 @@ const ActionListHeader =
<input <input
{...styling('actionListHeaderSearch')} {...styling('actionListHeaderSearch')}
onChange={e => onSearch(e.target.value)} onChange={e => onSearch(e.target.value)}
placeholder='filter...' placeholder="filter..."
/> />
{!hideMainButtons && {!hideMainButtons &&
<div {...styling('actionListHeaderWrapper')}> <div {...styling('actionListHeaderWrapper')}>

View File

@ -38,13 +38,13 @@ class ActionPreview extends Component {
); );
return ( return (
<div key='actionPreview' {...styling('actionPreview')}> <div key="actionPreview" {...styling('actionPreview')}>
<ActionPreviewHeader <ActionPreviewHeader
tabs={renderedTabs} tabs={renderedTabs}
{...{ styling, inspectedPath, onInspectPath, tabName, onSelectTab }} {...{ styling, inspectedPath, onInspectPath, tabName, onSelectTab }}
/> />
{!error && {!error &&
<div key='actionPreviewContent' {...styling('actionPreviewContent')}> <div key="actionPreviewContent" {...styling('actionPreviewContent')}>
<TabComponent <TabComponent
labelRenderer={this.labelRenderer} labelRenderer={this.labelRenderer}
{...{ {...{

View File

@ -2,7 +2,7 @@ import React from 'react';
const ActionPreviewHeader = const ActionPreviewHeader =
({ styling, inspectedPath, onInspectPath, tabName, onSelectTab, tabs }) => ({ styling, inspectedPath, onInspectPath, tabName, onSelectTab, tabs }) =>
(<div key='previewHeader' {...styling('previewHeader')}> (<div key="previewHeader" {...styling('previewHeader')}>
<div {...styling('tabSelector')}> <div {...styling('tabSelector')}>
{tabs.map(tab => {tabs.map(tab =>
(<div onClick={() => onSelectTab(tab.name)} (<div onClick={() => onSelectTab(tab.name)}

View File

@ -99,7 +99,14 @@ export default class DevtoolsInspector extends Component {
diffObjectHash: PropTypes.func, diffObjectHash: PropTypes.func,
diffPropertyFilter: PropTypes.func, diffPropertyFilter: PropTypes.func,
hideMainButtons: PropTypes.bool, hideMainButtons: PropTypes.bool,
hideActionButtons: PropTypes.bool hideActionButtons: PropTypes.bool,
invertTheme: PropTypes.bool,
skippedActionIds: PropTypes.array,
dataTypeKey: PropTypes.string,
tabs: PropTypes.oneOfType([
PropTypes.array,
PropTypes.func
])
}; };
static update = reducer; static update = reducer;
@ -128,7 +135,7 @@ export default class DevtoolsInspector extends Component {
}; };
updateSizeMode() { updateSizeMode() {
const isWideLayout = this.refs.inspector.offsetWidth > 500; const isWideLayout = this.inspectorRef.offsetWidth > 500;
if (isWideLayout !== this.state.isWideLayout) { if (isWideLayout !== this.state.isWideLayout) {
this.setState({ isWideLayout }); this.setState({ isWideLayout });
@ -157,6 +164,10 @@ export default class DevtoolsInspector extends Component {
} }
} }
inspectorCreateRef = (node) => {
this.inspectorRef = node;
};
render() { render() {
const { const {
stagedActionIds: actionIds, actionsById: actions, computedStates, draggableActions, stagedActionIds: actionIds, actionsById: actions, computedStates, draggableActions,
@ -171,8 +182,8 @@ export default class DevtoolsInspector extends Component {
const { base16Theme, styling } = themeState; const { base16Theme, styling } = themeState;
return ( return (
<div key='inspector' <div key="inspector"
ref='inspector' ref={this.inspectorCreateRef}
{...styling(['inspector', isWideLayout && 'inspectorWide'], isWideLayout)}> {...styling(['inspector', isWideLayout && 'inspectorWide'], isWideLayout)}>
<ActionList {...{ <ActionList {...{
actions, actionIds, isWideLayout, searchValue, selectedActionId, startActionId, actions, actionIds, isWideLayout, searchValue, selectedActionId, startActionId,

View File

@ -251,12 +251,9 @@ const getSheetFromColorMap = map => ({
inspectedPathKeyLink: { inspectedPathKeyLink: {
cursor: 'pointer', cursor: 'pointer',
'&:hover': {
'text-decoration': 'underline'
},
color: map.LINK_COLOR, color: map.LINK_COLOR,
'&:hover': { '&:hover': {
'text-decoration': 'underline',
color: map.LINK_HOVER_COLOR color: map.LINK_HOVER_COLOR
} }
}, },

View File

@ -38,7 +38,7 @@ export default function getInspectedState(state, path, convertImmutable) {
if (convertImmutable) { if (convertImmutable) {
try { try {
state = fromJS(state).toJS(); state = fromJS(state).toJS();
} catch(e) {} } catch(e) {} // eslint-disable-line no-empty
} }
return state; return state;

View File

@ -1,4 +0,0 @@
lib
**/node_modules
**/webpack.config.js
examples/**/server.js

View File

@ -1,20 +0,0 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"jest": true,
"node": true
},
"rules": {
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"no-console": 0,
// Temporarily disabled due to babel-eslint issues:
"block-scoped-var": 0,
"padded-blocks": 0,
},
"plugins": [
"react"
]
}

View File

@ -6,10 +6,9 @@
"scripts": { "scripts": {
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"lint": "eslint src test",
"test": "jest", "test": "jest",
"prepare": "npm run build", "prepare": "npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build" "prepublishOnly": "npm run test && npm run clean && npm run build"
}, },
"files": [ "files": [
"lib", "lib",
@ -36,13 +35,9 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.3.17", "babel-cli": "^6.3.17",
"babel-core": "^6.3.17", "babel-core": "^6.3.17",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.0", "babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3", "babel-preset-es2015-loose": "^6.1.3",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "^0.23",
"eslint-config-airbnb": "0.0.6",
"eslint-plugin-react": "^2.3.0",
"expect": "^1.6.0", "expect": "^1.6.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"redux": "^4.0.0", "redux": "^4.0.0",

View File

@ -139,7 +139,7 @@ function computeWithTryCatch(reducer, action, state) {
// In Chrome, rethrowing provides better source map support // In Chrome, rethrowing provides better source map support
setTimeout(() => { throw err; }); setTimeout(() => { throw err; });
} else { } else {
console.error(err); console.error(err); // eslint-disable-line no-console
} }
} }

View File

@ -67,12 +67,12 @@ describe('instrument', () => {
it('should provide observable', () => { it('should provide observable', () => {
let lastValue; let lastValue;
let calls = 0; // let calls = 0;
Observable.from(store) Observable.from(store)
.subscribe(state => { .subscribe(state => {
lastValue = state; lastValue = state;
calls++; // calls++;
}); });
expect(lastValue).toBe(0); expect(lastValue).toBe(0);

View File

@ -1,2 +0,0 @@
lib
**/node_modules

View File

@ -1,20 +0,0 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
},
"rules": {
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"no-console": 0,
// Temporarily disabled due to babel-eslint issues:
"block-scoped-var": 0,
"padded-blocks": 0,
},
"plugins": [
"react"
]
}

View File

@ -10,9 +10,8 @@
"scripts": { "scripts": {
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"lint": "eslint src test",
"prepare": "npm run build", "prepare": "npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build" "prepublishOnly": "npm run test && npm run clean && npm run build"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -36,14 +35,10 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.3.15", "babel-cli": "^6.3.15",
"babel-core": "^6.1.20", "babel-core": "^6.1.20",
"babel-eslint": "^5.0.0-beta4",
"babel-loader": "^6.2.0", "babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3", "babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "^0.23",
"eslint-config-airbnb": "0.0.6",
"eslint-plugin-react": "^3.6.3",
"rimraf": "^2.3.4" "rimraf": "^2.3.4"
}, },
"peerDependencies": { "peerDependencies": {

View File

@ -166,6 +166,7 @@ export default class LogMonitor extends Component {
return themes[theme]; return themes[theme];
} }
// eslint-disable-next-line no-console
console.warn('DevTools theme ' + theme + ' not found, defaulting to nicinabox'); console.warn('DevTools theme ' + theme + ' not found, defaulting to nicinabox');
return themes.nicinabox; return themes.nicinabox;
} }

View File

@ -1,3 +0,0 @@
lib
demo
**/node_modules

View File

@ -1,18 +0,0 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"jest": true,
"node": true
},
"rules": {
"prefer-template": 0,
"no-shadow": 0,
"comma-dangle": 0,
"react/sort-comp": 0
},
"parser": "babel-eslint",
"plugins": [
"react"
]
}

View File

@ -10,10 +10,9 @@
"start": "webpack-dev-server", "start": "webpack-dev-server",
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"lint": "eslint src test",
"test": "jest --no-cache", "test": "jest --no-cache",
"prepare": "npm run clean && npm run build", "prepare": "npm run clean && npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build" "prepublishOnly": "npm run test && npm run clean && npm run build"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -38,7 +37,6 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.10.1", "babel-cli": "^6.10.1",
"babel-core": "^6.10.4", "babel-core": "^6.10.4",
"babel-eslint": "^6.0.5",
"babel-loader": "^6.2.4", "babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0", "babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-loose": "^7.0.0", "babel-preset-es2015-loose": "^7.0.0",
@ -49,11 +47,6 @@
"css-loader": "^0.26.1", "css-loader": "^0.26.1",
"enzyme": "^2.6.0", "enzyme": "^2.6.0",
"enzyme-to-json": "^1.3.0", "enzyme-to-json": "^1.3.0",
"eslint": "^2.13.1",
"eslint-config-airbnb": "^9.0.1",
"eslint-plugin-import": "^1.9.2",
"eslint-plugin-jsx-a11y": "^1.5.3",
"eslint-plugin-react": "^5.2.2",
"expect": "^1.20.1", "expect": "^1.20.1",
"export-files-webpack-plugin": "0.0.1", "export-files-webpack-plugin": "0.0.1",
"file-loader": "^0.10.0", "file-loader": "^0.10.0",

View File

@ -95,6 +95,7 @@ export default class TestGenerator extends (PureComponent || Component) {
}; };
while (actions[i]) { while (actions[i]) {
// eslint-disable-next-line no-useless-escape
if (!isVanilla || /^┗?\s?[a-zA-Z0-9_@.\[\]-]+?$/.test(actions[i].action.type)) { if (!isVanilla || /^┗?\s?[a-zA-Z0-9_@.\[\]-]+?$/.test(actions[i].action.type)) {
if (isFirst) isFirst = false; if (isFirst) isFirst = false;
else r += space; else r += space;

View File

@ -1,34 +0,0 @@
{
"extends": "plugin:flowtype/recommended",
"globals": {
"chrome": true
},
"env": {
"jest": true,
"browser": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"parser": "babel-eslint",
"rules": {
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"react/sort-comp": 0,
"react/jsx-quotes": 0,
"eol-last": 0,
"no-unused-vars": 0,
"no-console": 1,
"comma-dangle": 0
},
"plugins": [
"react",
"flowtype"
]
}

View File

@ -16,15 +16,12 @@
"scripts": { "scripts": {
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"lint": "eslint src test",
"lint:fix": "eslint --fix src test",
"test": "jest --no-cache", "test": "jest --no-cache",
"prepare": "npm run clean && npm run build", "prepare": "npm run clean && npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build" "prepublishOnly": "npm run test && npm run clean && npm run build"
}, },
"devDependencies": { "devDependencies": {
"babel-cli": "^6.10.1", "babel-cli": "^6.10.1",
"babel-eslint": "^10.0.0",
"babel-loader": "^6.2.4", "babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-transform": "^2.0.0", "babel-plugin-react-transform": "^2.0.0",
@ -40,11 +37,6 @@
"enzyme": "^3.0.0", "enzyme": "^3.0.0",
"enzyme-adapter-react-16": "1.7.1", "enzyme-adapter-react-16": "1.7.1",
"enzyme-to-json": "^3.3.0", "enzyme-to-json": "^3.3.0",
"eslint": "^5.0.0",
"eslint-plugin-flowtype": "3.2.0",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.1",
"eslint-plugin-react": "7.4.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"react-addons-test-utils": "^15.4.0", "react-addons-test-utils": "^15.4.0",
"react-dom": "^16.4.0", "react-dom": "^16.4.0",

View File

@ -1,4 +1,4 @@
import React, { Component, PropTypes } from 'react'; import React, { Component } from 'react';
import {getStackFrames} from './react-error-overlay/utils/getStackFrames'; import {getStackFrames} from './react-error-overlay/utils/getStackFrames';
import StackTrace from './react-error-overlay/containers/StackTrace'; import StackTrace from './react-error-overlay/containers/StackTrace';
@ -104,7 +104,7 @@ export default class StackTraceTab extends Component {
<div style={rootStyle}> <div style={rootStyle}>
<StackTrace <StackTrace
stackFrames={stackFrames} stackFrames={stackFrames}
errorName={"N/A"} errorName="N/A"
contextSize={3} contextSize={3}
editorHandler={this.onStackLocationClicked} editorHandler={this.onStackLocationClicked}
/> />

View File

@ -7,7 +7,7 @@ function openResource(fileName, lineNumber, stackFrame) {
if(result.isError) { if(result.isError) {
const {fileName: finalFileName, lineNumber: finalLineNumber} = stackFrame; const {fileName: finalFileName, lineNumber: finalLineNumber} = stackFrame;
const adjustedLineNumber = Math.max(finalLineNumber - 1, 0); const adjustedLineNumber = Math.max(finalLineNumber - 1, 0);
chrome.devtools.panels.openResource(finalFileName, adjustedLineNumber, (result) => { chrome.devtools.panels.openResource(finalFileName, adjustedLineNumber, (/* result */) => {
// console.log("openResource result: ", result); // console.log("openResource result: ", result);
}); });
} }
@ -42,7 +42,7 @@ function openInIframe(url) {
function openInEditor(editor, path, stackFrame) { function openInEditor(editor, path, stackFrame) {
const projectPath = path.replace(/\/$/, ''); const projectPath = path.replace(/\/$/, '');
const file = stackFrame._originalFileName || stackFrame.finalFileName || stackFrame.fileName || ''; const file = stackFrame._originalFileName || stackFrame.finalFileName || stackFrame.fileName || '';
let filePath = /^https?:\/\//.test(file) ? file.replace(/^https?:\/\/[^\/]*/, '') : file.replace(/^\w+:\/\//, ''); let filePath = /^https?:\/\//.test(file) ? file.replace(/^https?:\/\/[^/]*/, '') : file.replace(/^\w+:\/\//, '');
filePath = filePath.replace(/^\/~\//, '/node_modules/'); filePath = filePath.replace(/^\/~\//, '/node_modules/');
const line = stackFrame._originalLineNumber || stackFrame.lineNumber || '0'; const line = stackFrame._originalLineNumber || stackFrame.lineNumber || '0';
const column = stackFrame._originalColumnNumber || stackFrame.columnNumber || '0'; const column = stackFrame._originalColumnNumber || stackFrame.columnNumber || '0';
@ -68,7 +68,8 @@ function openInEditor(editor, path, stackFrame) {
} }
export default function openFile(fileName, lineNumber, stackFrame) { export default function openFile(fileName, lineNumber, stackFrame) {
if (process.env.NODE_ENV === 'development') console.log(fileName, lineNumber, stackFrame); // eslint-disable-line no-console // eslint-disable-next-line no-console
if (process.env.NODE_ENV === 'development') console.log(fileName, lineNumber, stackFrame);
if (!chrome || !chrome.storage) return; // TODO: Pass editor settings for using outside of browser extension if (!chrome || !chrome.storage) return; // TODO: Pass editor settings for using outside of browser extension
const storage = isFF ? chrome.storage.local : chrome.storage.sync || chrome.storage.local; const storage = isFF ? chrome.storage.local : chrome.storage.sync || chrome.storage.local;
storage.get(['useEditor', 'editor', 'projectPath'], function({ useEditor, editor, projectPath }) { storage.get(['useEditor', 'editor', 'projectPath'], function({ useEditor, editor, projectPath }) {

View File

@ -93,7 +93,7 @@ class StackFrame extends Component<Props, State> {
this.props.editorHandler(errorLoc); this.props.editorHandler(errorLoc);
}; };
onKeyDown = (e: SyntheticKeyboardEvent<>) => { onKeyDown = (e /* : SyntheticKeyboardEvent<> */) => {
if (e.key === 'Enter') { if (e.key === 'Enter') {
this.editorHandler(); this.editorHandler();
} }

View File

@ -10,12 +10,13 @@ import React from 'react';
import CodeBlock from '../components/CodeBlock'; import CodeBlock from '../components/CodeBlock';
import { applyStyles } from '../utils/dom/css'; import { applyStyles } from '../utils/dom/css';
import { absolutifyCaret } from '../utils/dom/absolutifyCaret'; import { absolutifyCaret } from '../utils/dom/absolutifyCaret';
import type { ScriptLine } from '../utils/stack-frame'; // import type { ScriptLine } from '../utils/stack-frame';
import generateAnsiHTML from '../utils/generateAnsiHTML'; import generateAnsiHTML from '../utils/generateAnsiHTML';
import { codeFrameColumns } from '@babel/code-frame'; import { codeFrameColumns } from '@babel/code-frame';
import { nicinabox as theme } from 'redux-devtools-themes'; import { nicinabox as theme } from 'redux-devtools-themes';
/*
type StackFrameCodeBlockPropsType = {| type StackFrameCodeBlockPropsType = {|
lines: ScriptLine[], lines: ScriptLine[],
lineNum: number, lineNum: number,
@ -27,8 +28,9 @@ type StackFrameCodeBlockPropsType = {|
// Exact type workaround for spread operator. // Exact type workaround for spread operator.
// See: https://github.com/facebook/flow/issues/2405 // See: https://github.com/facebook/flow/issues/2405
type Exact<T> = $Shape<T>; type Exact<T> = $Shape<T>;
*/
function StackFrameCodeBlock(props: Exact<StackFrameCodeBlockPropsType>) { function StackFrameCodeBlock(props /* : Exact<StackFrameCodeBlockPropsType> */) {
const { lines, lineNum, columnNum, contextSize, main } = props; const { lines, lineNum, columnNum, contextSize, main } = props;
const sourceCode = []; const sourceCode = [];
let whiteSpace = Infinity; let whiteSpace = Infinity;

View File

@ -14,7 +14,7 @@ import { toExclude } from '../../presets';
function getStackFrames( function getStackFrames(
error: Error, error: Error,
unhandledRejection: boolean = false, unhandledRejection: boolean = false, // eslint-disable-line no-unused-vars
contextSize: number = 3 contextSize: number = 3
): Promise<StackFrame[] | null> { ): Promise<StackFrame[] | null> {
const parsedFrames = parse(error); const parsedFrames = parse(error);

View File

@ -19,7 +19,8 @@ const actions = {
1: { type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' } }, 1: { type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' } },
2: { 2: {
type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' }, type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' },
stack: 'Error\n at fn1 (app.js:72:24)\n at fn2 (app.js:84:31)\n at fn3 (chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/page.bundle.js:1269:80)' stack: 'Error\n at fn1 (app.js:72:24)\n at fn2 (app.js:84:31)\n ' +
'at fn3 (chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/js/page.bundle.js:1269:80)'
} }
}; };

View File

@ -1,4 +0,0 @@
lib
**/node_modules
**/webpack.config.js
examples/**/server.js

View File

@ -1,20 +0,0 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
},
"rules": {
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"no-console": 0,
// Temporarily disabled due to babel-eslint issues:
"block-scoped-var": 0,
"padded-blocks": 0,
},
"plugins": [
"react"
]
}

View File

@ -1,3 +1,4 @@
/* eslint-disable no-console */
var webpack = require('webpack'); var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server'); var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config'); var config = require('./webpack.config');

View File

@ -4,8 +4,8 @@ import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor'; import DockMonitor from 'redux-devtools-dock-monitor';
export default createDevTools( export default createDevTools(
<DockMonitor toggleVisibilityKey='ctrl-h' <DockMonitor toggleVisibilityKey="ctrl-h"
changePositionKey='ctrl-q'> changePositionKey="ctrl-q">
<LogMonitor /> <LogMonitor />
</DockMonitor> </DockMonitor>
); );

View File

@ -20,9 +20,9 @@ export default class Footer extends Component {
render() { render() {
return ( return (
<footer className='footer'> <footer className="footer">
{this.renderTodoCount()} {this.renderTodoCount()}
<ul className='filters'> <ul className="filters">
{[SHOW_ALL, SHOW_UNMARKED, SHOW_MARKED].map(filter => {[SHOW_ALL, SHOW_UNMARKED, SHOW_MARKED].map(filter =>
<li key={filter}> <li key={filter}>
{this.renderFilterLink(filter)} {this.renderFilterLink(filter)}
@ -39,7 +39,7 @@ export default class Footer extends Component {
const itemWord = unmarkedCount === 1 ? 'item' : 'items'; const itemWord = unmarkedCount === 1 ? 'item' : 'items';
return ( return (
<span className='todo-count'> <span className="todo-count">
<strong>{unmarkedCount || 'No'}</strong> {itemWord} left <strong>{unmarkedCount || 'No'}</strong> {itemWord} left
</span> </span>
); );
@ -62,7 +62,7 @@ export default class Footer extends Component {
const { markedCount, onClearMarked } = this.props; const { markedCount, onClearMarked } = this.props;
if (markedCount > 0) { if (markedCount > 0) {
return ( return (
<button className='clear-completed' <button className="clear-completed"
onClick={onClearMarked} > onClick={onClearMarked} >
Clear completed Clear completed
</button> </button>

View File

@ -15,11 +15,11 @@ export default class Header extends Component {
render() { render() {
return ( return (
<header className='header'> <header className="header">
<h1>todos</h1> <h1>todos</h1>
<TodoTextInput newTodo={true} <TodoTextInput newTodo={true}
onSave={::this.handleSave} onSave={::this.handleSave}
placeholder='What needs to be done?' /> placeholder="What needs to be done?" />
</header> </header>
); );
} }

View File

@ -46,9 +46,9 @@ export default class MainSection extends Component {
); );
return ( return (
<section className='main'> <section className="main">
{this.renderToggleAll(markedCount)} {this.renderToggleAll(markedCount)}
<ul className='todo-list'> <ul className="todo-list">
{filteredTodos.map(todo => {filteredTodos.map(todo =>
<TodoItem key={todo.id} todo={todo} {...actions} /> <TodoItem key={todo.id} todo={todo} {...actions} />
)} )}
@ -65,8 +65,8 @@ export default class MainSection extends Component {
return ( return (
<div> <div>
<input id={this.htmlFormInputId} <input id={this.htmlFormInputId}
className='toggle-all' className="toggle-all"
type='checkbox' type="checkbox"
checked={markedCount === todos.length} checked={markedCount === todos.length}
onChange={actions.markAll} /> onChange={actions.markAll} />
<label htmlFor={this.htmlFormInputId}>Mark all as complete</label> <label htmlFor={this.htmlFormInputId}>Mark all as complete</label>

View File

@ -43,15 +43,15 @@ export default class TodoItem extends Component {
); );
} else { } else {
element = ( element = (
<div className='view'> <div className="view">
<input className='toggle' <input className="toggle"
type='checkbox' type="checkbox"
checked={todo.marked} checked={todo.marked}
onChange={() => markTodo(todo.id)} /> onChange={() => markTodo(todo.id)} />
<label onDoubleClick={::this.handleDoubleClick}> <label onDoubleClick={::this.handleDoubleClick}>
{todo.text} {todo.text}
</label> </label>
<button className='destroy' <button className="destroy"
onClick={() => deleteTodo(todo.id)} /> onClick={() => deleteTodo(todo.id)} />
</div> </div>
); );

View File

@ -44,9 +44,9 @@ export default class TodoTextInput extends Component {
edit: this.props.editing, edit: this.props.editing,
'new-todo': this.props.newTodo 'new-todo': this.props.newTodo
})} })}
type='text' type="text"
placeholder={this.props.placeholder} placeholder={this.props.placeholder}
autoFocus='true' autoFocus="true"
value={this.state.text} value={this.state.text}
onBlur={::this.handleBlur} onBlur={::this.handleBlur}
onChange={::this.handleChange} onChange={::this.handleChange}

View File

@ -4,8 +4,8 @@ import LogMonitor from 'redux-devtools-log-monitor';
import DockMonitor from 'redux-devtools-dock-monitor'; import DockMonitor from 'redux-devtools-dock-monitor';
export default createDevTools( export default createDevTools(
<DockMonitor toggleVisibilityKey='ctrl-h' <DockMonitor toggleVisibilityKey="ctrl-h"
changePositionKey='ctrl-q'> changePositionKey="ctrl-q">
<LogMonitor /> <LogMonitor />
</DockMonitor> </DockMonitor>
); );

View File

@ -34,12 +34,13 @@ export default function todos(state = initialState, action) {
todo todo
); );
case MARK_ALL: case MARK_ALL: {
const areAllMarked = state.every(todo => todo.marked); const areAllMarked = state.every(todo => todo.marked);
return state.map(todo => ({ return state.map(todo => ({
...todo, ...todo,
marked: !areAllMarked marked: !areAllMarked
})); }));
}
case CLEAR_MARKED: case CLEAR_MARKED:
return state.filter(todo => todo.marked === false); return state.filter(todo => todo.marked === false);

View File

@ -1,3 +1,4 @@
/* eslint-disable no-console */
var webpack = require('webpack'); var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server'); var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config'); var config = require('./webpack.config');

View File

@ -6,10 +6,9 @@
"scripts": { "scripts": {
"clean": "rimraf lib", "clean": "rimraf lib",
"build": "babel src --out-dir lib", "build": "babel src --out-dir lib",
"lint": "eslint src test examples",
"test": "jest", "test": "jest",
"prepare": "npm run build", "prepare": "npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run clean && npm run build" "prepublishOnly": "npm run test && npm run clean && npm run build"
}, },
"files": [ "files": [
"lib", "lib",
@ -36,14 +35,10 @@
"devDependencies": { "devDependencies": {
"babel-cli": "^6.3.17", "babel-cli": "^6.3.17",
"babel-core": "^6.3.17", "babel-core": "^6.3.17",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.0", "babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3", "babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "6.3.13", "babel-preset-react": "6.3.13",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "^0.23",
"eslint-config-airbnb": "0.0.6",
"eslint-plugin-react": "^2.3.0",
"jest": "^23.6.0", "jest": "^23.6.0",
"react": "^16.0.0", "react": "^16.0.0",
"react-dom": "^16.0.0", "react-dom": "^16.0.0",

View File

@ -4,6 +4,7 @@ import { connect, Provider, ReactReduxContext } from 'react-redux';
import instrument from 'redux-devtools-instrument'; import instrument from 'redux-devtools-instrument';
function logError(type) { function logError(type) {
/* eslint-disable no-console */
if (type === 'NoStore') { if (type === 'NoStore') {
console.error( console.error(
'Redux DevTools could not render. You must pass the Redux store ' + 'Redux DevTools could not render. You must pass the Redux store ' +
@ -17,7 +18,8 @@ function logError(type) {
'using createStore()?' 'using createStore()?'
); );
} }
} /* eslint-enable no-console */
}
export default function createDevTools(children) { export default function createDevTools(children) {
const monitorElement = Children.only(children); const monitorElement = Children.only(children);

View File

@ -32,7 +32,7 @@ export default function persistState(sessionId, deserializeState = identity, des
next(reducer, initialState); next(reducer, initialState);
} }
} catch (e) { } catch (e) {
console.warn('Could not read debug session from localStorage:', e); console.warn('Could not read debug session from localStorage:', e); // eslint-disable-line no-console
try { try {
localStorage.removeItem(key); localStorage.removeItem(key);
} finally { } finally {
@ -50,7 +50,7 @@ export default function persistState(sessionId, deserializeState = identity, des
try { try {
localStorage.setItem(key, JSON.stringify(store.getState())); localStorage.setItem(key, JSON.stringify(store.getState()));
} catch (e) { } catch (e) {
console.warn('Could not write debug session to localStorage:', e); console.warn('Could not write debug session to localStorage:', e); // eslint-disable-line no-console
} }
return action; return action;

View File

@ -1,3 +0,0 @@
lib
**/node_modules
examples/**/dist

View File

@ -1,22 +0,0 @@
{
"extends": "eslint-config-airbnb",
"env": {
"browser": true,
"mocha": true,
"node": true
},
"parser": "babel-eslint",
"rules": {
"comma-dangle": [2, "never"],
"jsx-quotes": [2, "prefer-single"],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/react-in-jsx-scope": 2,
"react/sort-comp": 0,
"react/forbid-prop-types": 0,
"import/no-extraneous-dependencies": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"jsx-a11y/no-static-element-interactions": 0
},
"plugins": ["react"]
}

Some files were not shown because too many files have changed in this diff Show More