Skip to content

Commit c80e8da

Browse files
authored
Separate lint and test scripts (#2232)
1 parent 6bc8a38 commit c80e8da

8 files changed

Lines changed: 28 additions & 111 deletions

File tree

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ rules:
3737
- never
3838
- exceptRange: true
3939

40-
import/extensions:
40+
import/extensions:
4141
- error
4242
- ignorePackages
4343
import/no-extraneous-dependencies:

.github/workflows/nodejs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
- name: yarn install, build, and test
2121
run: |
2222
yarn
23+
yarn lint
2324
yarn test
2425
yarn codecov
2526
env:

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tests/**/*
2+
!tests/**/jsfmt.spec.js

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ You may also need to declare php as the parser in your prettier config file:
234234
```json
235235
{
236236
"parser": "php",
237-
"plugins": ["@prettier/plugin-php"],
237+
"plugins": ["@prettier/plugin-php"]
238238
}
239239
```
240240

jest.config.js

Lines changed: 11 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,15 @@ export default {
88
"!<rootDir>/node_modules/",
99
"!<rootDir>/tests_config/",
1010
],
11-
projects: [
12-
RUN_STANDALONE_TESTS
13-
? {
14-
displayName: "test-standalone",
15-
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
16-
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
17-
snapshotSerializers: ["jest-snapshot-serializer-raw"],
18-
testEnvironment: "jsdom",
19-
globals: {
20-
STANDALONE: true,
21-
},
22-
runner: "jest-light-runner",
23-
transform: {},
24-
}
25-
: {
26-
displayName: "test-node",
27-
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
28-
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
29-
snapshotSerializers: ["jest-snapshot-serializer-raw"],
30-
testEnvironment: "node",
31-
globals: {
32-
STANDALONE: false,
33-
},
34-
runner: "jest-light-runner",
35-
transform: {},
36-
},
37-
{
38-
runner: "jest-runner-eslint",
39-
displayName: "lint",
40-
testMatch: ["<rootDir>/**/*.js"],
41-
testPathIgnorePatterns: [
42-
"<rootDir>/node_modules/",
43-
"<rootDir>/coverage/",
44-
],
45-
},
46-
],
11+
runner: "jest-light-runner",
12+
transform: {},
13+
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
14+
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
15+
snapshotSerializers: ["jest-snapshot-serializer-raw"],
16+
globals: {
17+
STANDALONE: RUN_STANDALONE_TESTS,
18+
},
19+
...(RUN_STANDALONE_TESTS
20+
? { displayName: "test-standalone", testEnvironment: "jsdom" }
21+
: { displayName: "test-node", testEnvironment: "node" }),
4722
};

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
"jest": "29.6.2",
4141
"jest-environment-jsdom": "29.6.2",
4242
"jest-light-runner": "^0.5.0",
43-
"jest-runner-eslint": "2.1.0",
4443
"jest-snapshot-serializer-raw": "^1.1.0",
4544
"prettier": "^3.0.1",
4645
"rollup": "^2.75.7",
@@ -56,6 +55,12 @@
5655
"prettier": "^3.0.0"
5756
},
5857
"scripts": {
58+
"lint": "yarn lint:eslint && yarn lint:prettier",
59+
"lint:eslint": "eslint .",
60+
"lint:prettier": "prettier . --check",
61+
"fix": "yarn fix:eslint && yarn fix:prettier",
62+
"fix:eslint": "eslint . --fix",
63+
"fix:prettier": "prettier . --write",
5964
"test": "yarn test:node && yarn test:standalone",
6065
"test:node": "jest",
6166
"test:standalone": "yarn run build-standalone && cross-env RUN_STANDALONE_TESTS=true yarn jest",

src/linguist-languages.cjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"use strict";
2-
3-
module.exports.LINGUIST_LANGUAGES_PHP = require("linguist-languages/data/PHP");
4-
module.exports.LINGUIST_LANGUAGES_HTML_PHP = require("linguist-languages/data/HTML+PHP");
1+
"use strict";
2+
3+
module.exports.LINGUIST_LANGUAGES_PHP = require("linguist-languages/data/PHP");
4+
module.exports.LINGUIST_LANGUAGES_HTML_PHP = require("linguist-languages/data/HTML+PHP");

yarn.lock

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,11 +1899,6 @@
18991899
resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.17.tgz#a8ddf6e0c2341718d74ee3dc413a13a042c45a0c"
19001900
integrity sha512-e8PUNQy1HgJGV3iU/Bp2+D/DXh3PYeyli8LgIwsQcs1Ar1LoaWHSIT6Rw+H2rNJmiq6SNWiDytfx8+gYj7wDHw==
19011901

1902-
"@types/parse-json@^4.0.0":
1903-
version "4.0.0"
1904-
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
1905-
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==
1906-
19071902
"@types/resolve@1.20.2":
19081903
version "1.20.2"
19091904
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.20.2.tgz#97d26e00cd4a0423b4af620abecf3e6f442b7975"
@@ -2414,7 +2409,7 @@ chalk@^2.0.0:
24142409
escape-string-regexp "^1.0.5"
24152410
supports-color "^5.3.0"
24162411

2417-
chalk@^4.0.0, chalk@^4.1.0:
2412+
chalk@^4.0.0:
24182413
version "4.1.2"
24192414
resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
24202415
integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
@@ -2532,26 +2527,6 @@ core-js-compat@^3.31.0:
25322527
dependencies:
25332528
browserslist "^4.21.9"
25342529

2535-
cosmiconfig@^7.0.0:
2536-
version "7.1.0"
2537-
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.1.0.tgz#1443b9afa596b670082ea46cbd8f6a62b84635f6"
2538-
integrity sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==
2539-
dependencies:
2540-
"@types/parse-json" "^4.0.0"
2541-
import-fresh "^3.2.1"
2542-
parse-json "^5.0.0"
2543-
path-type "^4.0.0"
2544-
yaml "^1.10.0"
2545-
2546-
create-jest-runner@^0.11.2:
2547-
version "0.11.2"
2548-
resolved "https://registry.yarnpkg.com/create-jest-runner/-/create-jest-runner-0.11.2.tgz#4b4f62ccef1e4de12e80f81c2cf8211fa392a962"
2549-
integrity sha512-6lwspphs4M1PLKV9baBNxHQtWVBPZuDU8kAP4MyrVWa6aEpEcpi2HZeeA6WncwaqgsGNXpP0N2STS7XNM/nHKQ==
2550-
dependencies:
2551-
chalk "^4.1.0"
2552-
jest-worker "^28.0.2"
2553-
throat "^6.0.1"
2554-
25552530
cross-env@^7.0.2:
25562531
version "7.0.3"
25572532
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
@@ -2710,13 +2685,6 @@ domexception@^4.0.0:
27102685
dependencies:
27112686
webidl-conversions "^7.0.0"
27122687

2713-
dot-prop@^6.0.1:
2714-
version "6.0.1"
2715-
resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083"
2716-
integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==
2717-
dependencies:
2718-
is-obj "^2.0.0"
2719-
27202688
electron-to-chromium@^1.4.202:
27212689
version "1.4.284"
27222690
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz#61046d1e4cab3a25238f6bf7413795270f125592"
@@ -3827,11 +3795,6 @@ is-number@^7.0.0:
38273795
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
38283796
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
38293797

3830-
is-obj@^2.0.0:
3831-
version "2.0.0"
3832-
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
3833-
integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==
3834-
38353798
is-path-inside@^3.0.3:
38363799
version "3.0.3"
38373800
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
@@ -4217,16 +4180,6 @@ jest-resolve@^29.6.2:
42174180
resolve.exports "^2.0.0"
42184181
slash "^3.0.0"
42194182

4220-
jest-runner-eslint@2.1.0:
4221-
version "2.1.0"
4222-
resolved "https://registry.yarnpkg.com/jest-runner-eslint/-/jest-runner-eslint-2.1.0.tgz#49f6372c2ee091f61e2bd9ad8a17c9538b5f5073"
4223-
integrity sha512-5gQOLej+HLDNzxrqOxg+l/ZY6hAHYhzO7gs3eOR+PQz14wpDuLDIivn+xJ8uwHW2tYM/37NGskqwBe5RbbJPEw==
4224-
dependencies:
4225-
chalk "^4.0.0"
4226-
cosmiconfig "^7.0.0"
4227-
create-jest-runner "^0.11.2"
4228-
dot-prop "^6.0.1"
4229-
42304183
jest-runner@^29.6.2:
42314184
version "29.6.2"
42324185
resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.6.2.tgz#89e8e32a8fef24781a7c4c49cd1cb6358ac7fc01"
@@ -4360,15 +4313,6 @@ jest-worker@^26.2.1:
43604313
merge-stream "^2.0.0"
43614314
supports-color "^7.0.0"
43624315

4363-
jest-worker@^28.0.2:
4364-
version "28.1.3"
4365-
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-28.1.3.tgz#7e3c4ce3fa23d1bb6accb169e7f396f98ed4bb98"
4366-
integrity sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g==
4367-
dependencies:
4368-
"@types/node" "*"
4369-
merge-stream "^2.0.0"
4370-
supports-color "^8.0.0"
4371-
43724316
jest-worker@^29.6.2:
43734317
version "29.6.2"
43744318
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.6.2.tgz#682fbc4b6856ad0aa122a5403c6d048b83f3fb44"
@@ -4902,7 +4846,7 @@ parent-module@^1.0.0:
49024846
dependencies:
49034847
callsites "^3.0.0"
49044848

4905-
parse-json@^5.0.0, parse-json@^5.2.0:
4849+
parse-json@^5.2.0:
49064850
version "5.2.0"
49074851
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.2.0.tgz#c76fc66dee54231c962b22bcc8a72cf2f99753cd"
49084852
integrity sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==
@@ -5615,11 +5559,6 @@ text-table@^0.2.0:
56155559
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
56165560
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
56175561

5618-
throat@^6.0.1:
5619-
version "6.0.2"
5620-
resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.2.tgz#51a3fbb5e11ae72e2cf74861ed5c8020f89f29fe"
5621-
integrity sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ==
5622-
56235562
titleize@^3.0.0:
56245563
version "3.0.0"
56255564
resolved "https://registry.yarnpkg.com/titleize/-/titleize-3.0.0.tgz#71c12eb7fdd2558aa8a44b0be83b8a76694acd53"
@@ -6021,11 +5960,6 @@ yallist@^4.0.0:
60215960
resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
60225961
integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
60235962

6024-
yaml@^1.10.0:
6025-
version "1.10.2"
6026-
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
6027-
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
6028-
60295963
yargs-parser@^21.0.0:
60305964
version "21.0.1"
60315965
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35"

0 commit comments

Comments
 (0)