@toptal/davinci-syntax 23.1.6 → 24.0.1-alpha-ff-79-27a22fcb.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/package.json +9 -8
- package/src/__tests__/__snapshots__/eslint.test.ts.snap +56 -39
- package/src/commands/lint-code.js +7 -9
- package/src/commands/lint-code.test.js +9 -10
- package/src/commands/lint-styles.js +4 -3
- package/src/configs/.eslintrc.cjs +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 24.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2643](https://github.com/toptal/davinci/pull/2643) [`ab9666f`](https://github.com/toptal/davinci/commit/ab9666f999e7a610f6068e0145200257d8511b46) Thanks [@rocodesign](https://github.com/rocodesign)!
|
|
8
|
+
Migrate package manager from Yarn to pnpm
|
|
9
|
+
**WHAT (breaking change):**
|
|
10
|
+
- switch package manager from Yarn to pnpm across the entire Davinci monorepo
|
|
11
|
+
- add `pnpm-workspace.yaml`, `.npmrc`, and `packageManager` field for corepack support
|
|
12
|
+
- convert Yarn `resolutions` to `pnpm.overrides` in root `package.json`
|
|
13
|
+
- update lerna `npmClient` from `yarn` to `pnpm`
|
|
14
|
+
- replace `yarn` with `pnpm` in root scripts (postinstall, test, test:unit:update)
|
|
15
|
+
**HOW to update:**
|
|
16
|
+
- install pnpm (`corepack enable` or `npm install -g pnpm@10.6.1`)
|
|
17
|
+
- replace `yarn install` with `pnpm install` in local workflows
|
|
18
|
+
- replace `yarn <script>` with `pnpm <script>` when running commands
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies [[`ab9666f`](https://github.com/toptal/davinci/commit/ab9666f999e7a610f6068e0145200257d8511b46)]:
|
|
23
|
+
- @toptal/davinci-cli-shared@3.0.0
|
|
24
|
+
- @toptal/davinci-dir-lint@2.0.0
|
|
25
|
+
- @toptal/eslint-plugin-davinci@6.0.0
|
|
26
|
+
- @toptal/stylelint-plugin-davinci@2.0.0
|
|
27
|
+
|
|
3
28
|
## 23.1.6
|
|
4
29
|
|
|
5
30
|
### Patch Changes
|
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toptal/davinci-syntax",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "24.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"lint"
|
|
6
6
|
],
|
|
@@ -26,16 +26,16 @@
|
|
|
26
26
|
"CHANGELOG.md"
|
|
27
27
|
],
|
|
28
28
|
"scripts": {
|
|
29
|
-
"lint": "
|
|
29
|
+
"lint": "pnpm run lint:path .",
|
|
30
30
|
"lint:path": "eslint --ext=.js,.jsx,.ts,.tsx --color --fix",
|
|
31
|
-
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings'
|
|
31
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' pnpm jest"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@stylelint/postcss-css-in-js": "^0.38.0",
|
|
35
|
-
"@toptal/davinci-cli-shared": "^
|
|
36
|
-
"@toptal/davinci-dir-lint": "^
|
|
37
|
-
"@toptal/eslint-plugin-davinci": "
|
|
38
|
-
"@toptal/stylelint-plugin-davinci": "
|
|
35
|
+
"@toptal/davinci-cli-shared": "^3.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
|
|
36
|
+
"@toptal/davinci-dir-lint": "^2.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
|
|
37
|
+
"@toptal/eslint-plugin-davinci": "^6.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
|
|
38
|
+
"@toptal/stylelint-plugin-davinci": "^2.0.1-alpha-ff-79-27a22fcb.1+27a22fcb",
|
|
39
39
|
"@typescript-eslint/eslint-plugin": "^6.7.3",
|
|
40
40
|
"@typescript-eslint/parser": "^6.7.3",
|
|
41
41
|
"eslint": "^8.34.0",
|
|
@@ -74,5 +74,6 @@
|
|
|
74
74
|
},
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
|
77
|
-
}
|
|
77
|
+
},
|
|
78
|
+
"gitHead": "27a22fcb012002a99ab87a4a996721e3ba8a92c4"
|
|
78
79
|
}
|
|
@@ -177,6 +177,8 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
177
177
|
],
|
|
178
178
|
'newlines-between': 'always',
|
|
179
179
|
distinctGroup: true,
|
|
180
|
+
sortTypesGroup: false,
|
|
181
|
+
named: false,
|
|
180
182
|
warnOnUnassignedImports: false,
|
|
181
183
|
},
|
|
182
184
|
],
|
|
@@ -452,6 +454,9 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
452
454
|
'no-unexpected-multiline': [
|
|
453
455
|
0,
|
|
454
456
|
],
|
|
457
|
+
'@typescript-eslint/lines-around-comment': [
|
|
458
|
+
0,
|
|
459
|
+
],
|
|
455
460
|
'@typescript-eslint/quotes': [
|
|
456
461
|
0,
|
|
457
462
|
],
|
|
@@ -506,9 +511,6 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
506
511
|
'function-paren-newline': [
|
|
507
512
|
'off',
|
|
508
513
|
],
|
|
509
|
-
'generator-star': [
|
|
510
|
-
'off',
|
|
511
|
-
],
|
|
512
514
|
'generator-star-spacing': [
|
|
513
515
|
'off',
|
|
514
516
|
],
|
|
@@ -539,12 +541,6 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
539
541
|
'new-parens': [
|
|
540
542
|
'off',
|
|
541
543
|
],
|
|
542
|
-
'no-arrow-condition': [
|
|
543
|
-
'off',
|
|
544
|
-
],
|
|
545
|
-
'no-comma-dangle': [
|
|
546
|
-
'off',
|
|
547
|
-
],
|
|
548
544
|
'no-extra-parens': [
|
|
549
545
|
'off',
|
|
550
546
|
],
|
|
@@ -563,21 +559,12 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
563
559
|
'no-multiple-empty-lines': [
|
|
564
560
|
'off',
|
|
565
561
|
],
|
|
566
|
-
'no-reserved-keys': [
|
|
567
|
-
'off',
|
|
568
|
-
],
|
|
569
|
-
'no-space-before-semi': [
|
|
570
|
-
'off',
|
|
571
|
-
],
|
|
572
562
|
'no-trailing-spaces': [
|
|
573
563
|
'off',
|
|
574
564
|
],
|
|
575
565
|
'no-whitespace-before-property': [
|
|
576
566
|
'off',
|
|
577
567
|
],
|
|
578
|
-
'no-wrap-func': [
|
|
579
|
-
'off',
|
|
580
|
-
],
|
|
581
568
|
'nonblock-statement-body-position': [
|
|
582
569
|
'off',
|
|
583
570
|
],
|
|
@@ -614,39 +601,18 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
614
601
|
'semi-style': [
|
|
615
602
|
'off',
|
|
616
603
|
],
|
|
617
|
-
'space-after-function-name': [
|
|
618
|
-
'off',
|
|
619
|
-
],
|
|
620
|
-
'space-after-keywords': [
|
|
621
|
-
'off',
|
|
622
|
-
],
|
|
623
604
|
'space-before-blocks': [
|
|
624
605
|
'off',
|
|
625
606
|
],
|
|
626
|
-
'space-before-function-parentheses': [
|
|
627
|
-
'off',
|
|
628
|
-
],
|
|
629
|
-
'space-before-keywords': [
|
|
630
|
-
'off',
|
|
631
|
-
],
|
|
632
|
-
'space-in-brackets': [
|
|
633
|
-
'off',
|
|
634
|
-
],
|
|
635
607
|
'space-in-parens': [
|
|
636
608
|
'off',
|
|
637
609
|
],
|
|
638
610
|
'space-infix-ops': [
|
|
639
611
|
'off',
|
|
640
612
|
],
|
|
641
|
-
'space-return-throw-case': [
|
|
642
|
-
'off',
|
|
643
|
-
],
|
|
644
613
|
'space-unary-ops': [
|
|
645
614
|
'off',
|
|
646
615
|
],
|
|
647
|
-
'space-unary-word-ops': [
|
|
648
|
-
'off',
|
|
649
|
-
],
|
|
650
616
|
'switch-colon-spacing': [
|
|
651
617
|
'off',
|
|
652
618
|
],
|
|
@@ -674,6 +640,9 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
674
640
|
'@babel/semi': [
|
|
675
641
|
'off',
|
|
676
642
|
],
|
|
643
|
+
'@typescript-eslint/block-spacing': [
|
|
644
|
+
'off',
|
|
645
|
+
],
|
|
677
646
|
'@typescript-eslint/brace-style': [
|
|
678
647
|
'off',
|
|
679
648
|
],
|
|
@@ -683,6 +652,9 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
683
652
|
'@typescript-eslint/indent': [
|
|
684
653
|
'off',
|
|
685
654
|
],
|
|
655
|
+
'@typescript-eslint/key-spacing': [
|
|
656
|
+
'off',
|
|
657
|
+
],
|
|
686
658
|
'@typescript-eslint/keyword-spacing': [
|
|
687
659
|
'off',
|
|
688
660
|
],
|
|
@@ -812,6 +784,9 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
812
784
|
'vue/array-bracket-spacing': [
|
|
813
785
|
'off',
|
|
814
786
|
],
|
|
787
|
+
'vue/array-element-newline': [
|
|
788
|
+
'off',
|
|
789
|
+
],
|
|
815
790
|
'vue/arrow-spacing': [
|
|
816
791
|
'off',
|
|
817
792
|
],
|
|
@@ -866,6 +841,9 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
866
841
|
'vue/multiline-html-element-content-newline': [
|
|
867
842
|
'off',
|
|
868
843
|
],
|
|
844
|
+
'vue/multiline-ternary': [
|
|
845
|
+
'off',
|
|
846
|
+
],
|
|
869
847
|
'vue/mustache-interpolation-spacing': [
|
|
870
848
|
'off',
|
|
871
849
|
],
|
|
@@ -911,12 +889,51 @@ exports[`eslint config verifies eslint rules are not updated silently 1`] = `
|
|
|
911
889
|
'vue/template-curly-spacing': [
|
|
912
890
|
'off',
|
|
913
891
|
],
|
|
892
|
+
'generator-star': [
|
|
893
|
+
'off',
|
|
894
|
+
],
|
|
914
895
|
'indent-legacy': [
|
|
915
896
|
'off',
|
|
916
897
|
],
|
|
898
|
+
'no-arrow-condition': [
|
|
899
|
+
'off',
|
|
900
|
+
],
|
|
901
|
+
'no-comma-dangle': [
|
|
902
|
+
'off',
|
|
903
|
+
],
|
|
904
|
+
'no-reserved-keys': [
|
|
905
|
+
'off',
|
|
906
|
+
],
|
|
907
|
+
'no-space-before-semi': [
|
|
908
|
+
'off',
|
|
909
|
+
],
|
|
917
910
|
'no-spaced-func': [
|
|
918
911
|
'off',
|
|
919
912
|
],
|
|
913
|
+
'no-wrap-func': [
|
|
914
|
+
'off',
|
|
915
|
+
],
|
|
916
|
+
'space-after-function-name': [
|
|
917
|
+
'off',
|
|
918
|
+
],
|
|
919
|
+
'space-after-keywords': [
|
|
920
|
+
'off',
|
|
921
|
+
],
|
|
922
|
+
'space-before-function-parentheses': [
|
|
923
|
+
'off',
|
|
924
|
+
],
|
|
925
|
+
'space-before-keywords': [
|
|
926
|
+
'off',
|
|
927
|
+
],
|
|
928
|
+
'space-in-brackets': [
|
|
929
|
+
'off',
|
|
930
|
+
],
|
|
931
|
+
'space-return-throw-case': [
|
|
932
|
+
'off',
|
|
933
|
+
],
|
|
934
|
+
'space-unary-word-ops': [
|
|
935
|
+
'off',
|
|
936
|
+
],
|
|
920
937
|
'react/jsx-space-before-closing': [
|
|
921
938
|
'off',
|
|
922
939
|
],
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { runSync, print } from '@toptal/davinci-cli-shared'
|
|
1
|
+
import { runSync, print, resolveBin } from '@toptal/davinci-cli-shared'
|
|
2
|
+
|
|
3
|
+
const eslintBin = resolveBin('eslint', import.meta.url)
|
|
2
4
|
|
|
3
5
|
const lintCodeCommand = (paths, options) => {
|
|
4
6
|
print.header('Running code checks')
|
|
@@ -6,14 +8,10 @@ const lintCodeCommand = (paths, options) => {
|
|
|
6
8
|
const { check, ext, color } = options
|
|
7
9
|
|
|
8
10
|
runSync(
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`--color=${color}`,
|
|
14
|
-
!check && '--fix',
|
|
15
|
-
...paths,
|
|
16
|
-
].filter(Boolean)
|
|
11
|
+
eslintBin,
|
|
12
|
+
[`--ext=${ext}`, `--color=${color}`, !check && '--fix', ...paths].filter(
|
|
13
|
+
Boolean
|
|
14
|
+
)
|
|
17
15
|
)
|
|
18
16
|
}
|
|
19
17
|
|
|
@@ -3,8 +3,11 @@ import { jest } from '@jest/globals'
|
|
|
3
3
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4
4
|
import { Command } from 'commander'
|
|
5
5
|
|
|
6
|
+
const MOCK_ESLINT_BIN = '/resolved/eslint/bin/eslint.js'
|
|
7
|
+
|
|
6
8
|
jest.unstable_mockModule('@toptal/davinci-cli-shared', () => ({
|
|
7
9
|
runSync: jest.fn(),
|
|
10
|
+
resolveBin: jest.fn(() => MOCK_ESLINT_BIN),
|
|
8
11
|
print: {
|
|
9
12
|
header: jest.fn(),
|
|
10
13
|
},
|
|
@@ -42,8 +45,7 @@ describe('createLintCodeCommand', () => {
|
|
|
42
45
|
|
|
43
46
|
command.parse(argv)
|
|
44
47
|
|
|
45
|
-
expect(runSync).toHaveBeenCalledWith(
|
|
46
|
-
'eslint',
|
|
48
|
+
expect(runSync).toHaveBeenCalledWith(MOCK_ESLINT_BIN, [
|
|
47
49
|
'--ext=.js,.jsx,.ts,.tsx',
|
|
48
50
|
'--color=true',
|
|
49
51
|
'file1',
|
|
@@ -56,8 +58,8 @@ describe('createLintCodeCommand', () => {
|
|
|
56
58
|
label: 'handles --check',
|
|
57
59
|
input: ['node', 'code', '--check', 'file1', 'file2'],
|
|
58
60
|
output: [
|
|
59
|
-
|
|
60
|
-
['
|
|
61
|
+
MOCK_ESLINT_BIN,
|
|
62
|
+
['--ext=.js,.jsx,.ts,.tsx', '--color=true', 'file1', 'file2'],
|
|
61
63
|
],
|
|
62
64
|
},
|
|
63
65
|
{
|
|
@@ -71,9 +73,8 @@ describe('createLintCodeCommand', () => {
|
|
|
71
73
|
'file2',
|
|
72
74
|
],
|
|
73
75
|
output: [
|
|
74
|
-
|
|
76
|
+
MOCK_ESLINT_BIN,
|
|
75
77
|
[
|
|
76
|
-
'eslint',
|
|
77
78
|
'--ext=.js,.jsx,.ts,.tsx',
|
|
78
79
|
'--color=true',
|
|
79
80
|
'--fix',
|
|
@@ -88,9 +89,8 @@ describe('createLintCodeCommand', () => {
|
|
|
88
89
|
label: 'handles external options',
|
|
89
90
|
input: ['node', 'code', '-c', 'eslintrc_base', '.'],
|
|
90
91
|
output: [
|
|
91
|
-
|
|
92
|
+
MOCK_ESLINT_BIN,
|
|
92
93
|
[
|
|
93
|
-
'eslint',
|
|
94
94
|
'--ext=.js,.jsx,.ts,.tsx',
|
|
95
95
|
'--color=true',
|
|
96
96
|
'--fix',
|
|
@@ -108,9 +108,8 @@ describe('createLintCodeCommand', () => {
|
|
|
108
108
|
"'{hosts,libs,namespaces}/**/{src,cypress}/**/*.{js,jsx,ts,tsx,gql}'",
|
|
109
109
|
],
|
|
110
110
|
output: [
|
|
111
|
-
|
|
111
|
+
MOCK_ESLINT_BIN,
|
|
112
112
|
[
|
|
113
|
-
'eslint',
|
|
114
113
|
'--ext=.js,.jsx,.ts,.tsx',
|
|
115
114
|
'--color=true',
|
|
116
115
|
'--fix',
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
-
import { runSync, print } from '@toptal/davinci-cli-shared'
|
|
2
|
+
import { runSync, print, resolveBin } from '@toptal/davinci-cli-shared'
|
|
3
|
+
|
|
4
|
+
const stylelintBin = resolveBin('stylelint', import.meta.url)
|
|
3
5
|
|
|
4
6
|
const lintStylesCommand = (dir, options) => {
|
|
5
7
|
print.header('Running styles checks', dir)
|
|
@@ -9,9 +11,8 @@ const lintStylesCommand = (dir, options) => {
|
|
|
9
11
|
const hasExtension = path.extname(dir)
|
|
10
12
|
|
|
11
13
|
runSync(
|
|
12
|
-
|
|
14
|
+
stylelintBin,
|
|
13
15
|
[
|
|
14
|
-
'stylelint',
|
|
15
16
|
'--allow-empty-input',
|
|
16
17
|
options.mw && ['--max-warnings', options.mw].join('='),
|
|
17
18
|
hasExtension ? dir : `${dir}/**/styles.(js|jsx|ts|tsx)`,
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
|
|
3
|
+
const { createRequire } = require('module')
|
|
4
|
+
const path = require('path')
|
|
5
|
+
|
|
6
|
+
const projectRequire = createRequire(path.join(process.cwd(), 'package.json'))
|
|
7
|
+
|
|
3
8
|
const projectHasPackage = pkg => {
|
|
4
9
|
try {
|
|
5
|
-
|
|
10
|
+
projectRequire.resolve(pkg)
|
|
6
11
|
|
|
7
12
|
return true
|
|
8
13
|
} catch {
|