Skip to content

Commit f53595b

Browse files
committed
Fix all the various lint violations detected by eslint.
1 parent 65a85b0 commit f53595b

File tree

17 files changed

+75
-69
lines changed

17 files changed

+75
-69
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ modules/*/node_modules
33
tasks/*/node_modules
44
node_modules
55
js
6+
package.meta.js

apps/st2-actions/actions-details.component.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,11 @@ export default class ActionsDetails extends React.Component {
213213
},
214214
});
215215
}
216-
setWindowName(e){
217-
window.name="parent"
218-
}
216+
217+
setWindowName(e) {
218+
window.name = 'parent';
219+
}
220+
219221
handleRun(e, ...args) {
220222
e.preventDefault();
221223

@@ -259,7 +261,7 @@ setWindowName(e){
259261
target="_blank"
260262
to={`/action/${action.ref}`}
261263
className="st2-forms__button st2-details__toolbar-button"
262-
onClick ={e => this.setWindowName(e)}
264+
onClick={e => this.setWindowName(e)}
263265
>
264266
Edit
265267
</Link>

apps/st2-history/history-details.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default class HistoryDetails extends React.Component {
5656

5757
id: PropTypes.string,
5858
section: PropTypes.string,
59-
execution: PropTypes.object,
59+
execution: PropTypes.object, // eslint-disable-line react/no-unused-prop-types
6060
displayUTC: PropTypes.bool.isRequired,
6161
handleToggleUTC: PropTypes.func,
6262
}
@@ -74,7 +74,7 @@ export default class HistoryDetails extends React.Component {
7474
}
7575

7676
componentDidUpdate(prevProps) {
77-
const { id, execution } = this.props;
77+
const { id } = this.props;
7878

7979
if (id && id !== prevProps.id) {
8080
this.fetchExecution(id);

apps/st2-workflows/workflows.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default class Workflows extends Component {
7373
pack: PropTypes.string,
7474
meta: PropTypes.object,
7575
metaSource: PropTypes.string,
76-
setMeta: PropTypes.func,
76+
setMeta: PropTypes.func, // eslint-disable-line react/no-unused-prop-types
7777
input: PropTypes.array,
7878
workflowSource: PropTypes.string,
7979
dirty: PropTypes.bool,
@@ -243,7 +243,7 @@ export default class Workflows extends Component {
243243
}
244244

245245
save() {
246-
const { pack, meta, actions, workflowSource, metaSource, setMeta } = this.props;
246+
const { pack, meta, actions, workflowSource, metaSource } = this.props;
247247
const existingAction = actions.find(e => e.name === meta.name && e.pack === pack);
248248

249249
if (!meta.name) {

modules/st2-action-reporter/action-reporter.component.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ const DEFAULT_MAX_RESULT_SIZE = 100 * 1024; // 100 KB
4242
*/
4343
function getBaseAPIUrl(api) {
4444
if (!api.server) {
45-
console.log("config.js is not correctly configured - it's missing API server URL entry")
45+
console.log('config.js is not correctly configured - it\'s missing API server URL entry');
4646
return null;
4747
}
4848

4949
if (!api.server.api) {
50-
console.log("config.js is not correctly configured - it's missing API server URL entry")
50+
console.log('config.js is not correctly configured - it\'s missing API server URL entry');
5151
return null;
5252
}
5353

54-
var url = api.server.api;
55-
var baseUrl;
54+
const url = api.server.api;
55+
let baseUrl;
5656

57-
if (!url.startsWith("http://") && !(url.startsWith("https://"))) {
57+
if (!url.startsWith('http://') && !(url.startsWith('https://'))) {
5858
baseUrl = `${window.location.protocol}${url}`;
5959
}
6060
else {
@@ -71,7 +71,7 @@ function getBaseAPIUrl(api) {
7171
* We specify a default value which can be overriden inside the config.
7272
*/
7373
function getMaxExecutionResultSizeForRender() {
74-
var maxResultSizeForRender;
74+
let maxResultSizeForRender;
7575

7676
try {
7777
maxResultSizeForRender = window.st2constants.st2Config.max_execution_result_size_for_render || DEFAULT_MAX_RESULT_SIZE;
@@ -88,6 +88,7 @@ export default class ActionReporter extends React.Component {
8888
className: PropTypes.string,
8989
runner: PropTypes.string.isRequired,
9090
execution: PropTypes.object.isRequired,
91+
api: PropTypes.object.isRequired,
9192
}
9293

9394
static utils = {
@@ -119,12 +120,12 @@ export default class ActionReporter extends React.Component {
119120

120121
return (
121122
<div {...props} className={cx(style.component, className)}>
122-
<div key="output" className={style.source}>Output</div>
123+
<div key="output" className={style.source}>Output</div>
123124
<p>
124-
Action output is too large to be displayed here ({`${resultSizeMB}`} MB).<br /><br />You can view raw execution output by clicking <a href={`${viewRawResultUrl}`} target="_blank">here</a> or you can download the output by clicking <a href={`${downloadRawResultUrl}`} target="_blank">here (uncompressed)</a> or <a href={`${downloadCompressedRawResultUrl}`} target="_blank">here (compressed)</a>.
125+
Action output is too large to be displayed here ({`${resultSizeMB}`} MB).<br /><br />You can view raw execution output by clicking <a href={`${viewRawResultUrl}`} target="_blank" rel="noopener noreferrer">here</a> or you can download the output by clicking <a href={`${downloadRawResultUrl}`} target="_blank" rel="noopener noreferrer">here (uncompressed)</a> or <a href={`${downloadCompressedRawResultUrl}`} target="_blank" rel="noopener noreferrer">here (compressed)</a>.
125126
</p>
126127
</div>
127-
);
128+
);
128129
}
129130

130131
return (

modules/st2-action-reporter/tests/test-action-reporter.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ describe(`${ActionReporter.name} Component`, () => {
2525
it('proxies className', () => {
2626
const instance = ReactTester.create(
2727
<ActionReporter
28-
className="foobar"
29-
runner="noop"
28+
className='foobar'
29+
runner='noop'
3030
execution={{}}
31-
api={{server: {api: "https://example.com:3000/v1"}}}
31+
api={{server: {api: 'https://example.com:3000/v1'}}}
3232
/>
3333
);
3434

@@ -38,10 +38,10 @@ describe(`${ActionReporter.name} Component`, () => {
3838
it('proxies extra props', () => {
3939
const instance = ReactTester.create(
4040
<ActionReporter
41-
foo="bar"
42-
runner="noop"
41+
foo='bar'
42+
runner='noop'
4343
execution={{}}
44-
api={{server: {api: "https://example.com:3000/v1"}}}
44+
api={{server: {api: 'https://example.com:3000/v1'}}}
4545
/>
4646
);
4747

@@ -51,16 +51,16 @@ describe(`${ActionReporter.name} Component`, () => {
5151
it('returns correct message on large result', () => {
5252
const instance = ReactTester.create(
5353
<ActionReporter
54-
foo="bar"
55-
runner="noop"
56-
execution={{id: "id1", result_size: 500 * 10244}}
57-
api={{server: {api: "https://example.com:3000/v1"}}}
54+
foo='bar'
55+
runner='noop'
56+
execution={{id: 'id1', result_size: 500 * 10244}}
57+
api={{server: {api: 'https://example.com:3000/v1'}}}
5858
/>
5959
);
6060

61-
const pElem = instance.toJSON()["children"][1].children.join("");
62-
expect(pElem).to.contain("Action output is too large to be displayed here")
63-
expect(pElem).to.contain("You can view raw")
61+
const pElem = instance.toJSON().children[1].children.join('');
62+
expect(pElem).to.contain('Action output is too large to be displayed here');
63+
expect(pElem).to.contain('You can view raw');
6464
});
6565
});
6666
});

modules/st2-api/api.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,29 @@ export class API {
175175

176176
const headers = {
177177
'content-type': 'application/json',
178-
179-
180178
};
181179

182180
if (this.token && this.token.token) {
183181
headers['x-auth-token'] = this.token.token;
184182
}
185-
183+
186184
const config = {
187185
method,
188186
url: this.route(opts),
189187
params: query,
190188
headers,
191-
transformResponse: [function transformResponse(data, headers) {
192-
if (typeof data === 'string' && headers["content-type"] === "application/json") {
193-
try {
194-
data = JSON.parse(data);
195-
} catch (e) { /* Ignore */ }
196-
}
197-
return data;
198-
}
199-
],
189+
transformResponse: [ function transformResponse(data, headers) {
190+
if (typeof data === 'string' && headers['content-type'] === 'application/json') {
191+
try {
192+
data = JSON.parse(data);
193+
}
194+
catch (e) {
195+
/* Ignore */
196+
}
197+
}
198+
199+
return data;
200+
} ],
200201
data,
201202
withCredentials: true,
202203
paramsSerializer: params => {

modules/st2-menu/menu.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ export default class Menu extends React.Component {
8484
const server = api.server;
8585
const showVersion = window.st2constants.st2Config.show_version_in_header || false;
8686
const hasPackageMeta = (window.st2constants.st2PackageMeta !== undefined);
87-
const st2webCommitsUrl = (showVersion && hasPackageMeta) ? "https://github.com/StackStorm/st2web/commit/" + window.st2constants.st2PackageMeta.git_sha : ""
87+
const st2webCommitsUrl = (showVersion && hasPackageMeta) ? `https://github.com/StackStorm/st2web/commit/${window.st2constants.st2PackageMeta.git_sha}` : '';
8888

8989
return (
9090
<header {...props} className={cx(style.component, className)}>
91-
<a href="#" className={style.logo} /> { (showVersion && hasPackageMeta) ? <span style={{ fontSize: 15, marginTop: 30 }}>st2: v{window.st2constants.st2PackageMeta.version}, st2web: <a href={st2webCommitsUrl} target="_blank">{window.st2constants.st2PackageMeta.git_sha}</a></span> : '' }
91+
<a href="#" className={style.logo} /> { (showVersion && hasPackageMeta) ? <span style={{ fontSize: 15, marginTop: 30 }}>st2: v{window.st2constants.st2PackageMeta.version}, st2web: <a href={st2webCommitsUrl} target="_blank" rel="noopener noreferrer">{window.st2constants.st2PackageMeta.git_sha}</a></span> : '' }
9292

9393
<div className={style.spacer} />
9494

modules/st2-pack-icon/pack-icon.component.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ export default class PackIcon extends React.Component {
8282
<img src="img/icon.png" width="32" height="32" />
8383
);
8484
}
85+
/* Unreachable code, commented out :shrug:
8586
return (
8687
<img className={cx(style.image, small && style.imageSmall)} src={icons[name]} />
8788
);
89+
*/
8890
// ^^ WAT?
8991
}
9092

modules/st2-time/tests/test-time.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ import { ReactTester } from '@stackstorm/module-test-utils';
2020
import Time from '..';
2121

2222
function isDST(d) {
23-
let jan = new Date(d.getFullYear(), 0, 1).getTimezoneOffset();
24-
let jul = new Date(d.getFullYear(), 6, 1).getTimezoneOffset();
25-
return Math.max(jan, jul) != d.getTimezoneOffset();
23+
const jan = new Date(d.getFullYear(), 0, 1).getTimezoneOffset();
24+
const jul = new Date(d.getFullYear(), 6, 1).getTimezoneOffset();
25+
return Math.max(jan, jul) !== d.getTimezoneOffset();
2626
}
2727

2828
describe(`${Time.name} Component`, () => {

0 commit comments

Comments
 (0)