Skip to content

Commit

Permalink
Updating eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
crspeller committed Nov 17, 2016
1 parent be74ec2 commit 64a3d26
Show file tree
Hide file tree
Showing 18 changed files with 53 additions and 56 deletions.
26 changes: 15 additions & 11 deletions webapp/.eslintrc.json
@@ -1,12 +1,13 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 8,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"impliedStrict": true,
"modules": true
"modules": true,
"experimentalObjectRestSpread": true
}
},
"parser": "babel-eslint",
Expand Down Expand Up @@ -50,6 +51,7 @@
"dot-notation": 2,
"eqeqeq": [2, "smart"],
"func-call-spacing": [2, "never"],
"func-name-matching": 0,
"func-names": 2,
"func-style": [2, "declaration"],
"generator-star-spacing": [2, {"before": false, "after": true}],
Expand Down Expand Up @@ -136,6 +138,7 @@
"no-proto": 2,
"no-redeclare": 2,
"no-return-assign": [2, "always"],
"no-return-await": 2,
"no-script-url": 2,
"no-self-assign": [2, {"props": true}],
"no-self-compare": 2,
Expand Down Expand Up @@ -166,6 +169,7 @@
"no-useless-constructor": 2,
"no-useless-escape": 2,
"no-useless-rename": 2,
"no-useless-return": 2,
"no-var": 0,
"no-void": 2,
"no-warning-comments": 1,
Expand All @@ -182,14 +186,14 @@
"prefer-arrow-callback": 2,
"prefer-const": 2,
"prefer-numeric-literals": 2,
"prefer-reflect": 2,
"prefer-rest-params": 2,
"prefer-spread": 2,
"prefer-template": 0,
"quote-props": [2, "as-needed"],
"quotes": [2, "single", "avoid-escape"],
"radix": 2,
"react/display-name": [2, { "ignoreTranspilerName": false }],
"react/forbid-component-props": 0,
"react/jsx-boolean-value": [2, "always"],
"react/jsx-closing-bracket-location": [2, { "location": "tag-aligned" }],
"react/jsx-curly-spacing": [2, "never"],
Expand All @@ -202,41 +206,41 @@
"react/jsx-key": 2,
"react/jsx-max-props-per-line": [2, { "maximum": 1 }],
"react/jsx-no-bind": 0,
"react/jsx-no-comment-textnodes": 2,
"react/jsx-no-duplicate-props": [2, { "ignoreCase": false }],
"react/jsx-no-literals": 2,
"react/jsx-no-target-blank": 2,
"react/jsx-no-undef": 2,
"react/jsx-pascal-case": 2,
"react/jsx-space-before-closing": [2, "never"],
"react/jsx-tag-spacing": [2, { "closingSlash": "never", "beforeSelfClosing": "never", "afterOpening": "never" }],
"react/jsx-uses-react": 2,
"react/jsx-uses-vars": 2,
"react/jsx-no-comment-textnodes": 2,
"react/jsx-wrap-multilines": 2,
"react/no-children-prop": 2,
"react/no-danger": 0,
"react/no-danger-with-children": 2,
"react/no-deprecated": 2,
"react/no-did-mount-set-state": 2,
"react/no-did-update-set-state": 2,
"react/no-direct-mutation-state": 2,
"react/no-find-dom-node": 1,
"react/no-is-mounted": 2,
"react/no-multi-comp": [2, { "ignoreStateless": true }],
"react/no-render-return-value": 2,
"react/no-set-state": 0,
"react/no-string-refs": 0,
"react/no-unescaped-entities": 2,
"react/no-unknown-property": 2,
"react/no-unused-prop-types": [1, {"skipShapeProps": true}],
"react/prefer-es6-class": 2,
"react/prefer-stateless-function": 0,
"react/prop-types": 2,
"react/require-optimization": 1,
"react/require-render-return": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 0,
"react/jsx-wrap-multilines": 2,
"react/no-find-dom-node": 1,
"react/forbid-component-props": 0,
"react/no-danger-with-children": 2,
"react/no-unused-prop-types": [1, {"skipShapeProps": true}],
"react/style-prop-object": 2,
"react/no-children-prop": 2,
"react/no-unescaped-entities": 2,
"require-yield": 2,
"rest-spread-spacing": [2, "never"],
"semi": [2, "always"],
Expand Down
8 changes: 4 additions & 4 deletions webapp/client/web_client.jsx
Expand Up @@ -17,23 +17,23 @@ class WebClientClass extends Client {
TeamStore.addChangeListener(this.onTeamStoreChanged);
}

onTeamStoreChanged = () => {
onTeamStoreChanged() {
this.setTeamId(TeamStore.getCurrentId());
}

track = (category, action, label, property, value) => {
track(category, action, label, property, value) {
if (global.window && global.window.analytics) {
global.window.analytics.track(action, {category, label, property, value});
}
}

trackPage = () => {
trackPage() {
if (global.window && global.window.analytics) {
global.window.analytics.page();
}
}

handleError = (err, res) => { // eslint-disable-line no-unused-vars
handleError(err, res) {
if (err.status === HTTP_UNAUTHORIZED && res.req.url !== '/api/v3/users/login') {
GlobalActions.emitUserLoggedOutEvent('/login');
}
Expand Down
6 changes: 3 additions & 3 deletions webapp/client/webrtc_session.jsx
Expand Up @@ -1951,7 +1951,7 @@ export default class WebrtcSession {
return (trickle === true);
}

unbindWebSocket = (onUnbindMessage, onUnbindError) => {
unbindWebSocket(onUnbindMessage, onUnbindError) {
for (var eventName in this.wsHandlers) {
if (this.wsHandlers.hasOwnProperty(eventName)) {
this.ws.removeEventListener(eventName, this.wsHandlers[eventName]);
Expand All @@ -1962,5 +1962,5 @@ export default class WebrtcSession {
if (this.wsKeepaliveTimeoutId) {
clearTimeout(this.wsKeepaliveTimeoutId);
}
};
}
}
}
4 changes: 2 additions & 2 deletions webapp/components/admin_console/cluster_settings.jsx
Expand Up @@ -60,7 +60,7 @@ export default class ClusterSettings extends AdminSettings {
);
}

overrideHandleChange = (id, value) => {
overrideHandleChange(id, value) {
this.setState({
showWarning: true
});
Expand Down Expand Up @@ -185,4 +185,4 @@ export default class ClusterSettings extends AdminSettings {
</SettingsGroup>
);
}
}
}
2 changes: 1 addition & 1 deletion webapp/components/admin_console/cluster_table.jsx
Expand Up @@ -176,4 +176,4 @@ export default class ClusterTable extends React.Component {
</div>
);
}
}
}
6 changes: 3 additions & 3 deletions webapp/components/admin_console/cluster_table_container.jsx
Expand Up @@ -18,7 +18,7 @@ export default class ClusterTableContainer extends React.Component {
};
}

load = () => {
load() {
Client.getClusterStatus(
(data) => {
this.setState({
Expand All @@ -44,7 +44,7 @@ export default class ClusterTableContainer extends React.Component {
}
}

reload = (e) => {
reload(e) {
if (e) {
e.preventDefault();
}
Expand All @@ -68,4 +68,4 @@ export default class ClusterTableContainer extends React.Component {
/>
);
}
}
}
2 changes: 1 addition & 1 deletion webapp/components/admin_console/file_upload_setting.jsx
Expand Up @@ -108,7 +108,7 @@ export default class FileUploadSetting extends Setting {
disabled={!this.state.fileSelected}
onClick={this.handleSubmit}
ref='upload_button'
data-loading-text={`<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> ${this.props.uploadingText}`}
data-loading-text={`<span class='glyphicon glyphicon-refresh glyphicon-refresh-animate'></span> ${this.props.uploadingText}`}
>
<FormattedMessage
id='admin.file_upload.uploadFile'
Expand Down
8 changes: 4 additions & 4 deletions webapp/components/channel_header.jsx
Expand Up @@ -641,10 +641,10 @@ export default class ChannelHeader extends React.Component {
id='channelHeader.removeFromFavorites'
defaultMessage='Remove from Favorites'
/> :
<FormattedMessage
id='channelHeader.addToFavorites'
defaultMessage='Add to Favorites'
/>}
<FormattedMessage
id='channelHeader.addToFavorites'
defaultMessage='Add to Favorites'
/>}
</Tooltip>
);
const toggleFavorite = (
Expand Down
1 change: 0 additions & 1 deletion webapp/components/login/login_controller.jsx
Expand Up @@ -167,7 +167,6 @@ export default class LoginController extends React.Component {
(err) => {
if (err.id === 'api.user.login.not_verified.app_error') {
browserHistory.push('/should_verify_email?&email=' + encodeURIComponent(loginId));
return;
} else if (err.id === 'store.sql_user.get_for_login.app_error' ||
err.id === 'ent.ldap.do_login.user_not_registered.app_error') {
this.setState({
Expand Down
8 changes: 4 additions & 4 deletions webapp/components/navbar.jsx
Expand Up @@ -501,10 +501,10 @@ export default class Navbar extends React.Component {
id='channelHeader.removeFromFavorites'
defaultMessage='Remove from Favorites'
/> :
<FormattedMessage
id='channelHeader.addToFavorites'
defaultMessage='Add to Favorites'
/>}
<FormattedMessage
id='channelHeader.addToFavorites'
defaultMessage='Add to Favorites'
/>}
</a>
</li>
);
Expand Down
2 changes: 1 addition & 1 deletion webapp/components/suggestion/at_mention_provider.jsx
Expand Up @@ -112,7 +112,7 @@ export default class AtMentionProvider {
handlePretextChanged(suggestionId, pretext) {
clearTimeout(this.timeoutId);

const captured = (/(?:^|\W)@([a-z0-9\-\._]*)$/i).exec(pretext.toLowerCase());
const captured = (/(?:^|\W)@([a-z0-9\-._]*)$/i).exec(pretext.toLowerCase());
if (captured) {
const prefix = captured[1];

Expand Down
2 changes: 0 additions & 2 deletions webapp/components/user_settings/user_settings_modal.jsx
Expand Up @@ -104,7 +104,6 @@ class UserSettingsModal extends React.Component {
}

this.props.onModalDismissed();
return;
}

// called after the dialog is fully hidden and faded out
Expand Down Expand Up @@ -251,7 +250,6 @@ class UserSettingsModal extends React.Component {
setRequireConfirm={
(requireConfirm) => {
this.requireConfirm = requireConfirm;
return;
}
}
/>
Expand Down
2 changes: 1 addition & 1 deletion webapp/components/youtube_video.jsx
Expand Up @@ -5,7 +5,7 @@ import ChannelStore from 'stores/channel_store.jsx';
import WebClient from 'client/web_client.jsx';
import * as Utils from 'utils/utils.jsx';

const ytRegex = /(?:http|https):\/\/(?:www\.|m\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^\/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#&\?]*)/;
const ytRegex = /(?:http|https):\/\/(?:www\.|m\.)?(?:(?:youtube\.com\/(?:(?:v\/)|(?:(?:watch|embed\/watch)(?:\/|.*v=))|(?:embed\/)|(?:user\/[^/]+\/u\/[0-9]\/)))|(?:youtu\.be\/))([^#&?]*)/;

import React from 'react';

Expand Down
6 changes: 3 additions & 3 deletions webapp/package.json
Expand Up @@ -38,7 +38,7 @@
},
"devDependencies": {
"babel-core": "6.18.2",
"babel-eslint": "6.1.2",
"babel-eslint": "7.1.0",
"babel-loader": "6.2.7",
"babel-plugin-transform-runtime": "6.15.0",
"babel-polyfill": "6.16.0",
Expand All @@ -48,8 +48,8 @@
"copy-webpack-plugin": "4.0.1",
"cross-env": "3.1.3",
"css-loader": "0.25.0",
"eslint": "3.5.0",
"eslint-plugin-react": "6.3.0",
"eslint": "3.10.2",
"eslint-plugin-react": "6.7.1",
"exports-loader": "0.6.3",
"extract-text-webpack-plugin": "1.0.1",
"file-loader": "0.9.0",
Expand Down
4 changes: 2 additions & 2 deletions webapp/utils/emoticons.jsx
Expand Up @@ -12,7 +12,7 @@ export const emoticonPatterns = {
smile: /(^|\s)(:-?d)(?=$|\s)/gi, // :D
stuck_out_tongue_closed_eyes: /(^|\s)(x-d)(?=$|\s)/gi, // x-d
stuck_out_tongue: /(^|\s)(:-?p)(?=$|\s)/gi, // :p
rage: /(^|\s)(:-?[\[@])(?=$|\s)/g, // :@
rage: /(^|\s)(:-?[[@])(?=$|\s)/g, // :@
slightly_frowning_face: /(^|\s)(:-?\()(?=$|\s)/g, // :(
cry: /(^|\s)(:['’]-?\(|:&#x27;\(|:&#39;\()(?=$|\s)/g, // :`(
confused: /(^|\s)(:-?\/)(?=$|\s)/g, // :/
Expand All @@ -23,7 +23,7 @@ export const emoticonPatterns = {
heart: /(^|\s)(<3|&lt;3)(?=$|\s)/g, // <3
broken_heart: /(^|\s)(<\/3|&lt;&#x2F;3)(?=$|\s)/g, // </3
thumbsup: /(^|\s)(:\+1:)(?=$|\s)/g, // :+1:
thumbsdown: /(^|\s)(:\-1:)(?=$|\s)/g // :-1:
thumbsdown: /(^|\s)(:-1:)(?=$|\s)/g // :-1:
};

export function handleEmoticons(text, tokens, emojis) {
Expand Down
2 changes: 1 addition & 1 deletion webapp/utils/markdown.jsx
Expand Up @@ -197,7 +197,7 @@ class MattermostMarkdownRenderer extends marked.Renderer {
}

listitem(text, bullet) {
const taskListReg = /^\[([ |xX])\] /;
const taskListReg = /^\[([ |xX])] /;
const isTaskList = taskListReg.exec(text);

if (isTaskList) {
Expand Down
4 changes: 2 additions & 2 deletions webapp/utils/text_formatting.jsx
Expand Up @@ -249,7 +249,7 @@ function autolinkChannelMentions(text, tokens, channelNamesMap, team) {
}

export function escapeRegex(text) {
return text.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
return text.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
}

function highlightCurrentMentions(text, tokens, mentionKeys = []) {
Expand Down Expand Up @@ -386,7 +386,7 @@ function parseSearchTerms(searchTerm) {
termString = termString.substring(captured[0].length);

// break the text up into words based on how the server splits them in SqlPostStore.SearchPosts and then discard empty terms
terms.push(...captured[0].split(/[ <>+\(\)~@]/).filter((term) => Boolean(term)));
terms.push(...captured[0].split(/[ <>+()~@]/).filter((term) => Boolean(term)));
continue;
}

Expand Down

0 comments on commit 64a3d26

Please sign in to comment.