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
build
dev
dist
*.log
.idea
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,
"devDependencies": {
"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",
"jest": "^23.6.0",
"lerna": "3.9.0",
@ -15,8 +18,9 @@
"publish": "lerna publish",
"canary": "lerna publish --canary preminor --npm-tag alpha",
"next": "lerna publish --bump prerelease --npm-tag next",
"lint": "lerna run lint --since master -- --color",
"lint:all": "lerna run lint -- --color",
"lint": "eslint '**/*.{js,jsx}' --cache",
"lint:fix": "eslint '**/*.{js,jsx}' --fix --cache",
"lint:all": "eslint '**/*.{js,jsx}'",
"test": "jest --onlyChanged",
"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",
"scripts": {
"clean": "rimraf lib dist",
"lint": "eslint src",
"build": "babel src --out-dir lib",
"build:umd": "webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"version": "npm run build",
"postversion": "git push && git push --tags && npm run clean",
"prepare": "npm run clean && npm run build",
"prepublishOnly":
"npm run lint && npm run clean && npm run build && npm run build:umd && npm run build:umd:min"
"prepublishOnly": "npm run clean && npm run build && npm run build:umd && npm run build:umd:min"
},
"files": [
"lib",
@ -37,14 +35,10 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^5.0.0-beta4",
"babel-loader": "^7.1.5",
"babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "^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",
"webpack": "^4.27.1",
"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": {
"start": "npm run storybook",
"build": "rimraf ./lib && babel ./src --out-dir ./lib --ignore tests,stories",
"lint": "eslint src",
"lintfix": "eslint src --fix",
"lint:css": "stylelint './src/**/styles/*.js'",
"format": "prettier-eslint --write ./src/**/*.js",
"test:update": "npm run jest -- -u",
"test": "jest --no-cache",
"storybook": "start-storybook -p 9001 -c .storybook -s ./fonts",
"publish-storybook": "bash .scripts/publish_storybook.sh",
"prepare": "npm run build",
"prepublishOnly": "npm run lint && npm run test && npm run build"
"prepublishOnly": "npm run test && npm run build"
},
"bugs": {
"url": "https://github.com/reduxjs/redux-devtools/issues"
@ -37,7 +34,6 @@
"@storybook/react": "4.0.9",
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^6.0.2",
"babel-jest": "^21.2.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-runtime": "^6.23.0",
@ -48,15 +44,9 @@
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2",
"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",
"jest": "^23.6.0",
"jsdom": "^11.3.0",
"prettier-eslint-cli": "^4.4.0",
"react": "^16.0.0",
"react-addons-test-utils": "^15.6.2",
"react-dom": "^16.0.0",

View File

@ -12,7 +12,6 @@ storiesOf('Dialog', module)
() => (
<Dialog
title={text('title', 'Dialog Title')}
children={text('children', 'Hello Dialog!')}
submitText={text('submitText', 'Submit!')}
open={boolean('open', true)}
noHeader={boolean('noHeader', false)}
@ -21,7 +20,9 @@ storiesOf('Dialog', module)
fullWidth={boolean('fullWidth', false)}
onDismiss={action('dialog dismissed')}
onSubmit={action('dialog submitted')}
/>
>
{text('children', 'Hello Dialog!')}
</Dialog>
)
)
.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:umd": "webpack --progress --config webpack.config.umd.js",
"build:umd:min": "webpack --env.minimize --progress --config webpack.config.umd.js",
"lint": "eslint src test",
"test": "jest",
"check": "npm run lint && npm run test",
"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": {
"type": "git",
@ -34,12 +32,10 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "4.1.8",
"babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"eslint": "1.10.3",
"immutable": "3.7.6",
"jest": "^23.6.0",
"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",
"scripts": {
"start": "node server.js",
"lint": "eslint src",
"stats": "NODE_ENV=production webpack --json > dist/stats.json"
},
"repository": {
@ -29,16 +28,10 @@
"homepage": "https://github.com/gaearon/react-hot-boilerplate",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.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-dev-server": "^2.4.1"
},

View File

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

View File

@ -34,9 +34,8 @@ const getValueLabelStyle = ({ style }, nodeType, keyPath) => ({
}
});
// eslint-disable-next-line max-len
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) {
this.value = value;

View File

@ -8,13 +8,10 @@
"build": "babel src --out-dir lib",
"build:umd": "rimraf ./umd && webpack --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",
"prepare": "npm run build",
"prepublishOnly":
"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",
"precommit": "lint-staged"
"prepublishOnly": "npm run test && npm run clean && npm run build && npm run build:umd && npm run build:umd:min",
"start": "cd examples && npm start"
},
"files": [
"lib",
@ -41,7 +38,6 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.1",
"babel-loader": "^7.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
@ -50,20 +46,8 @@
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-env": "^1.6.1",
"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",
"jest": "^23.6.0",
"lint-staged": "^4.3.0",
"prettier": "^1.7.4",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-test-renderer": "^16.0.0",
@ -80,8 +64,5 @@
"babel-runtime": "^6.6.1",
"prop-types": "^15.5.8",
"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} />;
default:
return (
<JSONValueNode {...simpleNodeProps} valueGetter={raw => `<${nodeType}>`} />
<JSONValueNode {...simpleNodeProps} valueGetter={() => `<${nodeType}>`} />
);
}
};

View File

@ -10,6 +10,7 @@ function open(app, options) {
[path.join(__dirname, '..', 'app')]
);
} catch (error) {
/* eslint-disable no-console */
if (error.message === 'Cannot find module \'electron\'') {
// 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');
@ -21,6 +22,7 @@ function open(app, options) {
} else {
console.log(error);
}
/* eslint-enable no-console */
}
return;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ var knex;
var baseFields = ['id', 'title', 'added'];
function error(msg) {
return new Promise(function(resolve, reject) {
return new Promise(function(resolve) {
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 app = express();
var routes = require('./routes');
@ -32,7 +32,7 @@ class Worker extends SCWorker {
store.list().then(function (data) {
req.socket.emit(req.channel, {type: 'list', data: data});
}).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) {
respond(null, data);
}).catch(function (error) {
console.error(error);
console.error(error); // eslint-disable-line no-console
});
});
socket.on('disconnect', function () {

View File

@ -41,12 +41,12 @@ describe('Server', function() {
socket = scClient.connect({ hostname: 'localhost', port: 8000 });
socket.connect();
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.connect();
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() {
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');
channel = socket.subscribe(channelName);
expect(channel.SUBSCRIBED).toBe('subscribed');
@ -73,24 +73,24 @@ describe('Server', function() {
it('should send message', function(done) {
var data = {
"type": "ACTION",
"payload": {
"todos": "do some"
'type': 'ACTION',
'payload': {
'todos': 'do some'
},
"action": {
"timestamp": 1483349708506,
"action": {
"type": "ADD_TODO",
"text": "hggg"
'action': {
'timestamp': 1483349708506,
'action': {
'type': 'ADD_TODO',
'text': 'hggg'
}
},
"instanceId": "tAmA7H5fclyWhvizAAAi",
"name": "LoggerInstance",
"id": "tAmA7H5fclyWhvizAAAi"
'instanceId': 'tAmA7H5fclyWhvizAAAi',
'name': 'LoggerInstance',
'id': 'tAmA7H5fclyWhvizAAAi'
};
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');
var channel2 = socket2.subscribe(channelName);
expect(channel2.SUBSCRIBED).toBe('subscribed');
@ -114,7 +114,8 @@ describe('Server', function() {
action: 'SOME_FINAL_ACTION',
payload: '[{"type":"ADD_TODO","text":"hi"},{"type":"SOME_FINAL_ACTION"}]',
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) {
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) {
// https://github.com/webpack/webpack/issues/418#issuecomment-53398056
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": "rimraf ./lib && babel ./src/app --out-dir lib",
"clean": "rimraf lib",
"lint": "eslint src test",
"lint:fix": "eslint src --fix",
"test": "jest --no-cache",
"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",
"files": [
@ -40,7 +38,6 @@
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-eslint": "^7.1.1",
"babel-loader": "^7.1.5",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-transform": "^2.0.2",
@ -55,11 +52,6 @@
"enzyme": "^3.1.0",
"enzyme-adapter-react-16": "^1.0.2",
"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",
"html-loader": "^0.4.4",
"html-webpack-plugin": "^3.2.0",

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
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 ExportButton from './buttons/ExportButton';
import ImportButton from './buttons/ImportButton';
@ -16,7 +16,7 @@ export default class BottomButtons extends Component {
options: PropTypes.object.isRequired
};
shouldComponentUpdate(nextProps, nextState) {
shouldComponentUpdate(nextProps) {
return nextProps.dispatcherIsOpen !== this.props.dispatcherIsOpen
|| nextProps.sliderIsOpen !== this.props.sliderIsOpen
|| nextProps.options !== this.props.options;

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
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 { connect } from 'react-redux';
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 { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Container, Form, Button } from 'devui';
import { Container, Form } from 'devui';
import { saveSocketSettings } from '../../actions';
const defaultSchema = {

View File

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { bindActionCreators } from '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 { changeTheme } from '../../actions';

View File

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

View File

@ -1,7 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
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 PersistButton from './buttons/PersistButton';
import LockButton from './buttons/LockButton';

View File

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

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Button } from 'devui';
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 { withTheme } from 'styled-components';
import getMonitor from '../utils/getMonitor';

View File

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

View File

@ -1,5 +1,4 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Editor } from 'devui';
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 styled, { withTheme } from 'styled-components';
import SliderMonitor from 'redux-slider-monitor';

View File

@ -1,5 +1,5 @@
import {
MONITOR_ACTION, SELECT_MONITOR, SELECT_MONITOR_TAB, UPDATE_MONITOR_STATE,
MONITOR_ACTION, SELECT_MONITOR, UPDATE_MONITOR_STATE,
TOGGLE_SLIDER, TOGGLE_DISPATCHER
} 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 = {
data: []

View File

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

View File

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

View File

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

View File

@ -14,6 +14,7 @@ export default function catchErrors(sendError) {
});
}
/* eslint-disable no-console */
if (
typeof console === 'object' && typeof console.error === 'function' && !console.beforeRemotedev
) {
@ -32,4 +33,5 @@ export default function catchErrors(sendError) {
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}
onSelect={value => this.setTheme(options, value)}
optionFilters={[]}>
{props => <FormControl {...props} type='text' />}
{props => <FormControl {...props} type="text" />}
</Combobox>
<InputGroup.Addon>
<a onClick={this.toggleTheme}

View File

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

View File

@ -8,13 +8,11 @@
"build:demo": "cross-env NODE_ENV=production webpack -p",
"stats": "webpack --profile --json > stats.json",
"start": "webpack-dev-server",
"lint": "eslint --ext .jsx,.js --max-warnings 0 src",
"preversion": "npm run lint",
"version": "npm run build:demo && git add -A .",
"postversion": "git push",
"prepublish": "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"
},
"main": "lib/index.js",
@ -25,7 +23,6 @@
"babel": "^6.3.26",
"babel-cli": "^6.4.5",
"babel-core": "^6.4.5",
"babel-eslint": "^7.1.0",
"babel-loader": "^7.1.5",
"babel-plugin-react-transform": "^2.0.0",
"babel-plugin-transform-runtime": "^6.4.3",
@ -36,10 +33,6 @@
"chokidar": "^1.6.1",
"clean-webpack-plugin": "^1.0.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",
"html-webpack-plugin": "^3.2.0",
"lodash.shuffle": "^4.2.0",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ export default function getInspectedState(state, path, convertImmutable) {
if (convertImmutable) {
try {
state = fromJS(state).toJS();
} catch(e) {}
} catch(e) {} // eslint-disable-line no-empty
}
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": {
"clean": "rimraf lib",
"build": "babel src --out-dir lib",
"lint": "eslint src test",
"test": "jest",
"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": [
"lib",
@ -36,13 +35,9 @@
"devDependencies": {
"babel-cli": "^6.3.17",
"babel-core": "^6.3.17",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3",
"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",
"jest": "^23.6.0",
"redux": "^4.0.0",

View File

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

View File

@ -67,12 +67,12 @@ describe('instrument', () => {
it('should provide observable', () => {
let lastValue;
let calls = 0;
// let calls = 0;
Observable.from(store)
.subscribe(state => {
lastValue = state;
calls++;
// calls++;
});
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": {
"clean": "rimraf lib",
"build": "babel src --out-dir lib",
"lint": "eslint src test",
"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": {
"type": "git",
@ -36,14 +35,10 @@
"devDependencies": {
"babel-cli": "^6.3.15",
"babel-core": "^6.1.20",
"babel-eslint": "^5.0.0-beta4",
"babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "^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"
},
"peerDependencies": {

View File

@ -166,6 +166,7 @@ export default class LogMonitor extends Component {
return themes[theme];
}
// eslint-disable-next-line no-console
console.warn('DevTools theme ' + theme + ' not found, defaulting to 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",
"clean": "rimraf lib",
"build": "babel src --out-dir lib",
"lint": "eslint src test",
"test": "jest --no-cache",
"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": {
"type": "git",
@ -38,7 +37,6 @@
"devDependencies": {
"babel-cli": "^6.10.1",
"babel-core": "^6.10.4",
"babel-eslint": "^6.0.5",
"babel-loader": "^6.2.4",
"babel-preset-es2015": "^6.9.0",
"babel-preset-es2015-loose": "^7.0.0",
@ -49,11 +47,6 @@
"css-loader": "^0.26.1",
"enzyme": "^2.6.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",
"export-files-webpack-plugin": "0.0.1",
"file-loader": "^0.10.0",

View File

@ -95,6 +95,7 @@ export default class TestGenerator extends (PureComponent || Component) {
};
while (actions[i]) {
// eslint-disable-next-line no-useless-escape
if (!isVanilla || /^┗?\s?[a-zA-Z0-9_@.\[\]-]+?$/.test(actions[i].action.type)) {
if (isFirst) isFirst = false;
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": {
"clean": "rimraf lib",
"build": "babel src --out-dir lib",
"lint": "eslint src test",
"lint:fix": "eslint --fix src test",
"test": "jest --no-cache",
"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": {
"babel-cli": "^6.10.1",
"babel-eslint": "^10.0.0",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-react-transform": "^2.0.0",
@ -40,11 +37,6 @@
"enzyme": "^3.0.0",
"enzyme-adapter-react-16": "1.7.1",
"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",
"react-addons-test-utils": "^15.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 StackTrace from './react-error-overlay/containers/StackTrace';
@ -104,7 +104,7 @@ export default class StackTraceTab extends Component {
<div style={rootStyle}>
<StackTrace
stackFrames={stackFrames}
errorName={"N/A"}
errorName="N/A"
contextSize={3}
editorHandler={this.onStackLocationClicked}
/>

View File

@ -7,7 +7,7 @@ function openResource(fileName, lineNumber, stackFrame) {
if(result.isError) {
const {fileName: finalFileName, lineNumber: finalLineNumber} = stackFrame;
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);
});
}
@ -42,7 +42,7 @@ function openInIframe(url) {
function openInEditor(editor, path, stackFrame) {
const projectPath = path.replace(/\/$/, '');
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/');
const line = stackFrame._originalLineNumber || stackFrame.lineNumber || '0';
const column = stackFrame._originalColumnNumber || stackFrame.columnNumber || '0';
@ -68,7 +68,8 @@ function openInEditor(editor, path, 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
const storage = isFF ? chrome.storage.local : chrome.storage.sync || chrome.storage.local;
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);
};
onKeyDown = (e: SyntheticKeyboardEvent<>) => {
onKeyDown = (e /* : SyntheticKeyboardEvent<> */) => {
if (e.key === 'Enter') {
this.editorHandler();
}

View File

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

View File

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

View File

@ -19,7 +19,8 @@ const actions = {
1: { type: 'PERFORM_ACTION', action: { type: 'INCREMENT_COUNTER' } },
2: {
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 WebpackDevServer = require('webpack-dev-server');
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';
export default createDevTools(
<DockMonitor toggleVisibilityKey='ctrl-h'
changePositionKey='ctrl-q'>
<DockMonitor toggleVisibilityKey="ctrl-h"
changePositionKey="ctrl-q">
<LogMonitor />
</DockMonitor>
);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,10 +6,9 @@
"scripts": {
"clean": "rimraf lib",
"build": "babel src --out-dir lib",
"lint": "eslint src test examples",
"test": "jest",
"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": [
"lib",
@ -36,14 +35,10 @@
"devDependencies": {
"babel-cli": "^6.3.17",
"babel-core": "^6.3.17",
"babel-eslint": "^4.1.6",
"babel-loader": "^6.2.0",
"babel-preset-es2015-loose": "^6.1.3",
"babel-preset-react": "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",
"react": "^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';
function logError(type) {
/* eslint-disable no-console */
if (type === 'NoStore') {
console.error(
'Redux DevTools could not render. You must pass the Redux store ' +
@ -17,7 +18,8 @@ function logError(type) {
'using createStore()?'
);
}
}
/* eslint-enable no-console */
}
export default function createDevTools(children) {
const monitorElement = Children.only(children);

View File

@ -32,7 +32,7 @@ export default function persistState(sessionId, deserializeState = identity, des
next(reducer, initialState);
}
} 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 {
localStorage.removeItem(key);
} finally {
@ -50,7 +50,7 @@ export default function persistState(sessionId, deserializeState = identity, des
try {
localStorage.setItem(key, JSON.stringify(store.getState()));
} 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;

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