Skip to content

Commit b29cb27

Browse files
committed
Fix eslint errors
1 parent 8c31366 commit b29cb27

9 files changed

+31
-25
lines changed

.eslintrc.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
'class-methods-use-this': 'warn',
1818
'no-use-before-define': ['error', { functions: false }],
1919
'no-param-reassign': ['error', { props: false }],
20+
'arrow-parens': ['error', 'as-needed'],
2021
},
2122

2223
parserOptions: {
@@ -33,5 +34,12 @@ module.exports = {
3334
jest: true,
3435
},
3536
},
37+
{
38+
files: ['**/*.ts', '**/*.vue'],
39+
rules: {
40+
'no-unused-vars': 'off',
41+
'@typescript-eslint/no-unused-vars': ['error'],
42+
},
43+
},
3644
],
3745
};

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@
7373
},
7474
"lint-staged": {
7575
"*.{js,vue,ts}": [
76-
"vue-cli-service lint",
77-
"git add"
76+
"vue-cli-service lint"
7877
]
7978
}
8079
}

src/QueryBuilderGroup.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
QueryBuilderConfig, RuleSet, Rule, OperatorDefinition, RuleDefinition,
1111
GroupOperatorSlotProps, GroupCtrlSlotProps, QueryBuilderGroup as QueryBuilderGroupInterface,
1212
} from '@/types';
13-
import { isRuleSet, isRule, isQueryBuilderConfig } from '@/guards';
13+
import { isQueryBuilderConfig } from '@/guards';
1414
import MergeTrap from '@/MergeTrap';
1515
import QueryBuilderChild from './QueryBuilderChild.vue';
1616

src/types.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ export interface RuleSlotProps {
4848
updateRuleData: (newData: any) => void,
4949
}
5050

51+
export interface QueryBuilderGroup extends Vue {
52+
selectedOperator: string,
53+
depth: number,
54+
trap: ((position: number, newChild: RuleSet | Rule) => void) | null,
55+
children: Array<RuleSet | Rule>,
56+
}
57+
5158
export interface ComponentRegistration {
5259
component: QueryBuilderGroup,
5360
ev: RuleSet,
@@ -58,10 +65,3 @@ export interface ComponentRegistration {
5865
export interface MergeTrap {
5966
registerSortUpdate(update: ComponentRegistration): void,
6067
}
61-
62-
export interface QueryBuilderGroup extends Vue {
63-
selectedOperator: string,
64-
depth: number,
65-
trap: ((position: number, newChild: RuleSet | Rule) => void) | null,
66-
children: Array<RuleSet | Rule>,
67-
}

tests/components/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</template>
1010

1111
<script lang="ts">
12-
import { Component, Vue, Watch } from 'vue-property-decorator';
12+
import { Component, Vue } from 'vue-property-decorator';
1313
1414
import QueryBuilder from '@/QueryBuilder.vue';
1515
import { RuleSet, QueryBuilderConfig } from '@/types';

tests/unit/colored-borders.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ describe('Testing drag\'n\'drop related features', () => {
115115
expect(groups).toHaveLength(9);
116116

117117
groups.wrappers
118-
.forEach((w) => {
118+
.forEach(w => {
119119
expect(w.vm.$props).toHaveProperty('depth');
120120
const el = (w.find('.query-builder-group__group-children')).element as HTMLDivElement;
121121
expect(el.style.borderColor).toBeFalsy();
@@ -141,7 +141,7 @@ describe('Testing drag\'n\'drop related features', () => {
141141
expect(groups).toHaveLength(9);
142142

143143
groups.wrappers
144-
.forEach((w) => {
144+
.forEach(w => {
145145
expect(w.vm.$props).toHaveProperty('depth');
146146
const el = (w.find('.query-builder-group__group-children')).element as HTMLDivElement;
147147
const targetIdx = w.vm.$props.depth % w.vm.$props.config.colors.length;

tests/unit/drag-n-drop.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('Test drag\'n\'drop related actions', () => {
130130
((qbClone.children[0] as RuleSet).children[3] as RuleSet).children = children;
131131

132132
const group = app.findAll(QueryBuilderGroup)
133-
.filter((qb) => {
133+
.filter(qb => {
134134
const vm = qb.vm as QueryBuilderGroupInterface;
135135

136136
return vm.selectedOperator === 'AND'
@@ -151,7 +151,7 @@ describe('Test drag\'n\'drop related actions', () => {
151151
expect(app.emitted().input[0][0]).toStrictEqual(qbClone);
152152
});
153153

154-
it('tests drag\'n\'drop by merging with a parent group', async (done) => {
154+
it('tests drag\'n\'drop by merging with a parent group', async done => {
155155
const app = mount(QueryBuilder, {
156156
propsData: {
157157
value,
@@ -170,7 +170,7 @@ describe('Test drag\'n\'drop related actions', () => {
170170

171171
// Removing branch
172172
const removerComponent = app.findAll(QueryBuilderGroup)
173-
.filter((qb) => {
173+
.filter(qb => {
174174
const vm = qb.vm as QueryBuilderGroupInterface;
175175

176176
return vm.selectedOperator === 'AND'
@@ -188,7 +188,7 @@ describe('Test drag\'n\'drop related actions', () => {
188188

189189
// Adding branch
190190
const adderComponent = app.findAll(QueryBuilderGroup)
191-
.filter((qb) => {
191+
.filter(qb => {
192192
const vm = qb.vm as QueryBuilderGroupInterface;
193193

194194
return vm.selectedOperator === 'AND'
@@ -212,7 +212,7 @@ describe('Test drag\'n\'drop related actions', () => {
212212
done();
213213
});
214214

215-
it('tests drag\'n\'dropping with merging within the adding group', async (done) => {
215+
it('tests drag\'n\'dropping with merging within the adding group', async done => {
216216
const app = mount(QueryBuilder, {
217217
propsData: {
218218
value,
@@ -229,7 +229,7 @@ describe('Test drag\'n\'drop related actions', () => {
229229

230230
// Removing branch
231231
const removerComponent = app.findAll(QueryBuilderGroup)
232-
.filter((qb) => {
232+
.filter(qb => {
233233
const vm = qb.vm as QueryBuilderGroupInterface;
234234

235235
return vm.selectedOperator === 'AND'
@@ -247,7 +247,7 @@ describe('Test drag\'n\'drop related actions', () => {
247247

248248
// Adding branch
249249
const adderComponent = app.findAll(QueryBuilderGroup)
250-
.filter((qb) => {
250+
.filter(qb => {
251251
const vm = qb.vm as QueryBuilderGroupInterface;
252252

253253
return vm.selectedOperator === 'AND'
@@ -271,7 +271,7 @@ describe('Test drag\'n\'drop related actions', () => {
271271
done();
272272
});
273273

274-
it('tests drag\'n\'dropping with merging within the deleting group', async (done) => {
274+
it('tests drag\'n\'dropping with merging within the deleting group', async done => {
275275
const app = mount(QueryBuilder, {
276276
propsData: {
277277
value,
@@ -288,7 +288,7 @@ describe('Test drag\'n\'drop related actions', () => {
288288

289289
// Removing branch
290290
const removerComponent = app.findAll(QueryBuilderGroup)
291-
.filter((qb) => {
291+
.filter(qb => {
292292
const vm = qb.vm as QueryBuilderGroupInterface;
293293

294294
return vm.selectedOperator === 'AND'
@@ -306,7 +306,7 @@ describe('Test drag\'n\'drop related actions', () => {
306306

307307
// Adding branch
308308
const adderComponent = app.findAll(QueryBuilderGroup)
309-
.filter((qb) => {
309+
.filter(qb => {
310310
const vm = qb.vm as QueryBuilderGroupInterface;
311311

312312
return vm.selectedOperator === 'AND'

tests/unit/query-builder.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ describe('Test basic functionality of QueryBuilder.vue', () => {
213213
.$parent
214214
.$emit('delete-child');
215215

216-
217216
expect(app.vm.$data.query).toStrictEqual({
218217
operatorIdentifier: 'and',
219218
children: [

vue.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module.exports = {
22
css: {
33
extract: false,
44
},
5-
chainWebpack: (config) => {
5+
chainWebpack: config => {
66
const svgRule = config.module.rule('svg');
77
svgRule.uses.clear();
88
svgRule.use('url-loader')

0 commit comments

Comments
 (0)