Skip to content

Commit

Permalink
Linting is hard?
Browse files Browse the repository at this point in the history
  • Loading branch information
jakkarth committed Mar 12, 2024
1 parent 83c6600 commit c08dfb1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/lists/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def list_tags
ids.push(*existing_by_name.map { |t| t.id })

Check failure on line 50 in app/controllers/api/v1/lists/tags_controller.rb

View workflow job for this annotation

GitHub Actions / lint

[Correctable] Style/SymbolProc: Pass &:id as an argument to map instead of a block.
not_existing_by_name = names.reject { |n| existing_by_name.any? { |e| e.name == Tag.normalize(n) }}

Check failure on line 51 in app/controllers/api/v1/lists/tags_controller.rb

View workflow job for this annotation

GitHub Actions / lint

[Correctable] Layout/SpaceInsideBlockBraces: Space missing inside }.
created = Tag.find_or_create_by_names(not_existing_by_name)
ids.push(*created.map(&:id)
ids.push(*created.map(&:id))
Tag.find(ids)
end

Expand Down
22 changes: 4 additions & 18 deletions app/javascript/flavours/glitch/features/list_editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@ const mapDispatchToProps = dispatch => ({
class ListEditor extends ImmutablePureComponent {
state = {
currentTab: 'accounts',
};

}

Check failure on line 40 in app/javascript/flavours/glitch/features/list_editor/index.jsx

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
static propTypes = {
intl: PropTypes.object.isRequired,
listId: PropTypes.string.isRequired,
onClose: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired,
Expand All @@ -62,27 +60,15 @@ class ListEditor extends ImmutablePureComponent {
onReset();
}

switchToAccounts() {
this.switchToTab('accounts');
}

switchToTags() {
this.switchToTab('tags');
}

switchToTab(tab) {
this.setState({ ...this.state, currentTab: tab });
}

render() {
const { accountIds, tags, searchAccountIds, onClear, intl } = this.props;
const showSearch = searchAccountIds.size > 0;
return (
<div className='modal-root__modal list-editor'>
<div className='modal-root__modal list-editor'>{this.state.currentTab}
<EditListForm />
<div className='tab__container'>
<div onClick={this.switchToAccounts} className={'tab ' + ('accounts' === this.state.currentTab ? 'tab__active' : '')}>{intl.formatMessage(messages.account_tab)} ({accountIds.size})</div>
<div onClick={this.switchToTags} className={'tab ' + ('tags' === this.state.currentTab ? 'tab__active' : '')}>{intl.formatMessage(messages.tag_tab)} ({tags.size})</div>
<button onClick={() => this.setState({ currentTab: 'accounts' })} className={'tab ' + ('accounts' === this.state.currentTab ? 'tab__active' : '')}>{intl.formatMessage(messages.account_tab)} ({accountIds.size})</button>

Check failure on line 70 in app/javascript/flavours/glitch/features/list_editor/index.jsx

View workflow job for this annotation

GitHub Actions / lint

JSX props should not use arrow functions
<button onClick={() => this.setState({ currentTab: 'tags' })} className={'tab ' + ('tags' === this.state.currentTab ? 'tab__active' : '')}>{intl.formatMessage(messages.tag_tab)} ({tags.size})</button>

Check failure on line 71 in app/javascript/flavours/glitch/features/list_editor/index.jsx

View workflow job for this annotation

GitHub Actions / lint

JSX props should not use arrow functions
</div>
<div id='list_editor_accounts' className={'accounts' === this.state.currentTab ? 'tab__active' : 'tab__inactive'}>
<Search />
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/flavours/glitch/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,4 @@
"status.local_only": "Only visible from your instance",
"status.uncollapse": "Uncollapse",
"suggestions.dismiss": "Dismiss suggestion"
}
}

0 comments on commit c08dfb1

Please sign in to comment.