Skip to content

Commit b406997

Browse files
Kocaljaviereguiluz
authored andcommitted
Drop ESLint and Prettier for Biome
1 parent f5b1413 commit b406997

File tree

137 files changed

+496
-1106
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+496
-1106
lines changed

biome.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"files": {
3+
"ignore": ["**/composer.json"]
4+
},
5+
"linter": {
6+
"rules": {
7+
"suspicious": {
8+
"noExplicitAny": "off",
9+
"noEmptyBlockStatements": "off"
10+
},
11+
"complexity": {
12+
"noStaticOnlyClass": "off",
13+
"noForEach": "off"
14+
},
15+
"style": {
16+
"noParameterAssign": "off"
17+
},
18+
"performance": {
19+
"noDelete": "off"
20+
}
21+
}
22+
},
23+
"formatter": {
24+
"lineWidth": 120,
25+
"indentStyle": "space",
26+
"indentWidth": 4
27+
},
28+
"javascript": {
29+
"formatter": {
30+
"trailingComma": "es5",
31+
"bracketSameLine": true,
32+
"quoteStyle": "single"
33+
}
34+
},
35+
"overrides": [
36+
{
37+
"include": ["*.svelte"],
38+
"linter": {
39+
"rules": {
40+
"style": {
41+
"useConst": "off"
42+
}
43+
}
44+
}
45+
}
46+
]
47+
}

package.json

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,28 @@
11
{
22
"private": true,
3-
"workspaces": [
4-
"src/*/assets"
5-
],
3+
"workspaces": ["src/*/assets"],
64
"scripts": {
75
"build": "node bin/build_javascript.js && node bin/build_styles.js",
86
"test": "bin/run-vitest-all.sh",
9-
"lint": "yarn workspaces run eslint src test",
10-
"format": "prettier src/*/assets/src/*.ts src/*/assets/test/*.js {,src/*/}*.{json,md} --write",
11-
"check-lint": "yarn lint --no-fix",
12-
"check-format": "yarn format --no-write --check"
7+
"lint": "yarn workspaces run biome lint src test --apply",
8+
"format": "biome format src/*/assets/src/*.ts src/*/assets/test/*.js {,src/*/}*.{json,md} --write",
9+
"check-lint": "yarn workspaces run biome lint src test",
10+
"check-format": "biome format src/*/assets/src/*.ts src/*/assets/test/*.js {,src/*/}*.{json,md}"
1311
},
1412
"devDependencies": {
1513
"@babel/core": "^7.15.8",
1614
"@babel/preset-env": "^7.15.8",
1715
"@babel/preset-react": "^7.15.8",
1816
"@babel/preset-typescript": "^7.15.8",
17+
"@biomejs/biome": "^1.7.3",
1918
"@rollup/plugin-commonjs": "^23.0.0",
2019
"@rollup/plugin-node-resolve": "^15.0.0",
2120
"@rollup/plugin-typescript": "^10.0.0",
2221
"@symfony/stimulus-testing": "^2.0.1",
23-
"@typescript-eslint/eslint-plugin": "^5.2.0",
24-
"@typescript-eslint/parser": "^5.2.0",
2522
"clean-css-cli": "^5.6.2",
26-
"eslint": "^8.1.0",
27-
"eslint-config-prettier": "^8.0.0",
28-
"prettier": "^2.2.1",
2923
"rollup": "^3.7.0",
3024
"tslib": "^2.3.1",
3125
"typescript": "^4.4.4",
3226
"vitest": "^0.34.6"
33-
},
34-
"eslintConfig": {
35-
"root": true,
36-
"parser": "@typescript-eslint/parser",
37-
"plugins": [
38-
"@typescript-eslint"
39-
],
40-
"extends": [
41-
"eslint:recommended",
42-
"prettier",
43-
"plugin:@typescript-eslint/eslint-recommended",
44-
"plugin:@typescript-eslint/recommended"
45-
],
46-
"rules": {
47-
"@typescript-eslint/no-explicit-any": "off",
48-
"@typescript-eslint/no-empty-function": "off",
49-
"@typescript-eslint/ban-ts-comment": "off",
50-
"quotes": [
51-
"error",
52-
"single"
53-
]
54-
},
55-
"env": {
56-
"browser": true
57-
},
58-
"overrides": [
59-
{
60-
"files": [
61-
"src/*/assets/test/**/*.ts"
62-
]
63-
}
64-
]
65-
},
66-
"prettier": {
67-
"printWidth": 120,
68-
"trailingComma": "es5",
69-
"tabWidth": 4,
70-
"bracketSameLine": true,
71-
"singleQuote": true
7227
}
7328
}

src/Autocomplete/assets/dist/controller.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ class default_1 extends Controller {
106106
if (!this.hasPreloadValue) {
107107
return 'focus';
108108
}
109-
if (this.preloadValue == 'false') {
109+
if (this.preloadValue === 'false') {
110110
return false;
111111
}
112-
if (this.preloadValue == 'true') {
112+
if (this.preloadValue === 'true') {
113113
return true;
114114
}
115115
return this.preloadValue;
@@ -260,12 +260,8 @@ _default_1_instances = new WeakSet(), _default_1_getCommonConfig = function _def
260260
};
261261
},
262262
render: {
263-
item: function (item) {
264-
return `<div>${item.text}</div>`;
265-
},
266-
option: function (item) {
267-
return `<div>${item.text}</div>`;
268-
},
263+
item: (item) => `<div>${item.text}</div>`,
264+
option: (item) => `<div>${item.text}</div>`,
269265
},
270266
});
271267
return __classPrivateFieldGet(this, _default_1_instances, "m", _default_1_createTomSelect).call(this, config);
@@ -298,18 +294,10 @@ _default_1_instances = new WeakSet(), _default_1_getCommonConfig = function _def
298294
return query.length >= 3;
299295
},
300296
optgroupField: 'group_by',
301-
score: function (search) {
302-
return function (item) {
303-
return 1;
304-
};
305-
},
297+
score: (search) => (item) => 1,
306298
render: {
307-
option: function (item) {
308-
return `<div>${item.text}</div>`;
309-
},
310-
item: function (item) {
311-
return `<div>${item.text}</div>`;
312-
},
299+
option: (item) => `<div>${item.text}</div>`,
300+
item: (item) => `<div>${item.text}</div>`,
313301
loading_more: () => {
314302
return `<div class="loading-more-results">${this.loadingMoreTextValue}</div>`;
315303
},

src/Autocomplete/assets/src/controller.ts

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Controller } from '@hotwired/stimulus';
22
import TomSelect from 'tom-select';
3-
import { TPluginHash } from 'tom-select/dist/types/contrib/microplugin';
4-
import { RecursivePartial, TomSettings, TomTemplates, TomLoadCallback } from 'tom-select/dist/types/types';
3+
import type { TPluginHash } from 'tom-select/dist/types/contrib/microplugin';
4+
import type { RecursivePartial, TomSettings, TomTemplates, TomLoadCallback } from 'tom-select/dist/types/types';
55

66
export interface AutocompletePreConnectOptions {
77
options: any;
@@ -175,12 +175,8 @@ export default class extends Controller {
175175
};
176176
},
177177
render: {
178-
item: function (item: any) {
179-
return `<div>${item.text}</div>`;
180-
},
181-
option: function (item: any) {
182-
return `<div>${item.text}</div>`;
183-
},
178+
item: (item: any) => `<div>${item.text}</div>`,
179+
option: (item: any) => `<div>${item.text}</div>`,
184180
},
185181
});
186182

@@ -231,18 +227,10 @@ export default class extends Controller {
231227
},
232228
optgroupField: 'group_by',
233229
// avoid extra filtering after results are returned
234-
score: function (search: string) {
235-
return function (item: any) {
236-
return 1;
237-
};
238-
},
230+
score: (search: string) => (item: any) => 1,
239231
render: {
240-
option: function (item: any) {
241-
return `<div>${item.text}</div>`;
242-
},
243-
item: function (item: any) {
244-
return `<div>${item.text}</div>`;
245-
},
232+
option: (item: any) => `<div>${item.text}</div>`,
233+
item: (item: any) => `<div>${item.text}</div>`,
246234
loading_more: (): string => {
247235
return `<div class="loading-more-results">${this.loadingMoreTextValue}</div>`;
248236
},
@@ -312,11 +300,11 @@ export default class extends Controller {
312300
return 'focus';
313301
}
314302

315-
if (this.preloadValue == 'false') {
303+
if (this.preloadValue === 'false') {
316304
return false;
317305
}
318306

319-
if (this.preloadValue == 'true') {
307+
if (this.preloadValue === 'true') {
320308
return true;
321309
}
322310

src/Autocomplete/assets/test/controller.test.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
1110

1211
import { Application } from '@hotwired/stimulus';
1312
import { getByTestId, waitFor } from '@testing-library/dom';
1413
import AutocompleteController, {
15-
AutocompleteConnectOptions,
16-
AutocompletePreConnectOptions,
14+
type AutocompleteConnectOptions,
15+
type AutocompletePreConnectOptions,
1716
} from '../src/controller';
1817
import userEvent from '@testing-library/user-event';
19-
import TomSelect from 'tom-select';
18+
import type TomSelect from 'tom-select';
2019
import createFetchMock from 'vitest-fetch-mock';
2120
import { vi } from 'vitest';
2221

src/Chartjs/assets/dist/controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Controller } from '@hotwired/stimulus';
22
import { registerables, Chart } from 'chart.js';
33

4-
if (registerables != undefined) {
4+
if (registerables) {
55
Chart.register(...registerables);
66
}
77
let isChartInitialized = false;
@@ -48,7 +48,7 @@ class default_1 extends Controller {
4848
const parentElement = this.element.parentElement;
4949
if (parentElement && this.chart.options.responsive) {
5050
const originalWidth = parentElement.style.width;
51-
parentElement.style.width = parentElement.offsetWidth + 1 + 'px';
51+
parentElement.style.width = `${parentElement.offsetWidth + 1}px`;
5252
setTimeout(() => {
5353
parentElement.style.width = originalWidth;
5454
}, 0);

src/Chartjs/assets/src/controller.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
11-
1210
import { Controller } from '@hotwired/stimulus';
1311
import { Chart, registerables } from 'chart.js';
1412

1513
// ChartJs 3.x
16-
if (registerables != undefined) {
14+
if (registerables) {
1715
Chart.register(...registerables);
1816
}
1917

@@ -80,7 +78,7 @@ export default class extends Controller {
8078
const parentElement = this.element.parentElement;
8179
if (parentElement && this.chart.options.responsive) {
8280
const originalWidth = parentElement.style.width;
83-
parentElement.style.width = parentElement.offsetWidth + 1 + 'px';
81+
parentElement.style.width = `${parentElement.offsetWidth + 1}px`;
8482
setTimeout(() => {
8583
parentElement.style.width = originalWidth;
8684
}, 0);

src/Chartjs/assets/test/controller.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
1110

1211
import { Application } from '@hotwired/stimulus';
1312
import { waitFor } from '@testing-library/dom';

src/Chartjs/assets/test/setup.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
11-
1210
import 'vitest-canvas-mock';
1311
// eslint-disable-next-line
1412
global.ResizeObserver = require('resize-observer-polyfill');

src/Cropperjs/assets/src/controller.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
11-
1210
import { Controller } from '@hotwired/stimulus';
1311
import Cropper from 'cropperjs';
1412
import CropEvent = Cropper.CropEvent;

src/Cropperjs/assets/test/controller.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
11-
1210
import { Application, Controller } from '@hotwired/stimulus';
1311
import { getByTestId, waitFor } from '@testing-library/dom';
1412
import { clearDOM, mountDOM } from '@symfony/stimulus-testing';
@@ -41,7 +39,7 @@ const dataToJsonAttribute = (data: any) => {
4139
}
4240

4341
describe('CropperjsController', () => {
44-
let container: any;
42+
let container: HTMLElement;
4543

4644
beforeEach(() => {
4745
container = mountDOM(`

src/Dropzone/assets/dist/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class default_1 extends Controller {
4747
const reader = new FileReader();
4848
reader.addEventListener('load', (event) => {
4949
this.previewImageTarget.style.display = 'block';
50-
this.previewImageTarget.style.backgroundImage = 'url("' + event.target.result + '")';
50+
this.previewImageTarget.style.backgroundImage = `url("${event.target.result}")`;
5151
});
5252
reader.readAsDataURL(file);
5353
}

src/Dropzone/assets/src/controller.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
* file that was distributed with this source code.
88
*/
99

10-
'use strict';
11-
1210
import { Controller } from '@hotwired/stimulus';
1311

1412
export default class extends Controller {
@@ -89,7 +87,7 @@ export default class extends Controller {
8987

9088
reader.addEventListener('load', (event: any) => {
9189
this.previewImageTarget.style.display = 'block';
92-
this.previewImageTarget.style.backgroundImage = 'url("' + event.target.result + '")';
90+
this.previewImageTarget.style.backgroundImage = `url("${event.target.result}")`;
9391
});
9492

9593
reader.readAsDataURL(file);

0 commit comments

Comments
 (0)