Skip to content

Commit f1bc675

Browse files
authored
Merge pull request #195 from JetBrains/dx-improve
DX: Check prettier by default linter, fix code by pre-commit hook, fix release files
2 parents deadb18 + ceda3c1 commit f1bc675

File tree

10 files changed

+450
-34
lines changed

10 files changed

+450
-34
lines changed

.eslintignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
node_modules
2-
dist
1+
/out
2+
/build
3+
/.idea
4+
/node_modules
5+
/dist
6+
/test-results/
7+
/playwright-report/
8+
/playwright/

.eslintrc.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
extends: [
77
'eslint:recommended',
88
'plugin:@typescript-eslint/recommended',
9-
'prettier',
9+
'plugin:prettier/recommended',
1010
],
1111
parser: '@typescript-eslint/parser',
1212
parserOptions: {
@@ -19,5 +19,10 @@ module.exports = {
1919
sourceType: 'module',
2020
},
2121
plugins: ['@typescript-eslint', 'eslint-plugin-import'],
22-
rules: {},
22+
rules: {
23+
quotes: ['error', 'single', {
24+
'avoidEscape': true,
25+
'allowTemplateLiterals': false
26+
}]
27+
}
2328
};

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.lintstagedrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"*.ts": [
3+
"npm run fix"
4+
]
5+
}

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

.prettierignore

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# Ignore everything recursively
2-
*
3-
# But not the .ts files
4-
!*.ts
5-
# Check subdirectories too
6-
!*/
1+
/out
2+
/build
3+
/.idea
4+
/node_modules
5+
/dist
6+
/test-results/
7+
/playwright-report/
8+
/playwright/

package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"repository": "JetBrains/kotlin-playground",
1212
"main": "dist/playground.min.js",
1313
"files": [
14-
"dist"
14+
"dist",
15+
"!dist/REMOVE_ME.js*"
1516
],
1617
"devDependencies": {
1718
"@babel/cli": "^7.21.5",
@@ -36,13 +37,16 @@
3637
"eslint": "^8.47.0",
3738
"eslint-config-prettier": "^9.0.0",
3839
"eslint-plugin-import": "^2.28.0",
40+
"eslint-plugin-prettier": "^5.0.1",
3941
"fast-async": "7",
4042
"fast-deep-equal": "^3.1.3",
4143
"file-loader": "^6.2.0",
4244
"flatten": "^1.0.2",
4345
"github-markdown-css": "^3.0.1",
4446
"html-webpack-plugin": "^5.5.3",
47+
"husky": "^8.0.3",
4548
"is-empty-object": "^1.1.1",
49+
"lint-staged": "^15.0.2",
4650
"lz-string": "^1.4.4",
4751
"markdown-it": "^12.3.2",
4852
"markdown-it-highlightjs": "^3.0.0",
@@ -53,7 +57,7 @@
5357
"monkberry-loader": "4.0.9",
5458
"postcss": "^8.4.31",
5559
"postcss-loader": "^7.3.3",
56-
"prettier": "^3.0.2",
60+
"prettier": "^3.0.3",
5761
"query-string": "^6.5.0",
5862
"sass": "^1.66.0",
5963
"sass-loader": "^13.3.2",
@@ -77,9 +81,10 @@
7781
"release:ci": "rm -rf dist && npm run build:all && $NPM_TOKEN=%env.NPM_TOKEN% npm publish",
7882
"start": "webpack-dev-server --port 9002",
7983
"lint": "eslint . --ext .ts",
80-
"prettier": "prettier --write .",
84+
"fix": "eslint --fix --ext .ts .",
8185
"test": "npm run build:all && npm run test:run",
8286
"test:run": "playwright test",
83-
"test:server": "node tests/utlis/server/index.js"
87+
"test:server": "node tests/utlis/server/index.js",
88+
"prepare": "husky install"
8489
}
8590
}

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { config as dotenv } from 'dotenv';
33
import { defineConfig, devices } from '@playwright/test';
44
import { isKeyOfObject } from './src/utils/types';
55

6-
dotenv({ path: `.env.local`, override: true });
6+
dotenv({ path: '.env.local', override: true });
77

88
const PROJECTS_LIST = {
99
DEV: ['Desktop Chrome'],

tests/crosslink.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,12 @@ ${' '}
6060
});
6161

6262
//language=text
63-
const codeWithMark = `fun containsEven(collection: Collection<Int>): Boolean = collection.any {[mark]TODO()[/mark]}`;
63+
const codeWithMark =
64+
'fun containsEven(collection: Collection<Int>): Boolean = collection.any {[mark]TODO()[/mark]}';
6465

6566
checkLink(generateCrosslink(codeWithMark), {
6667
//language=kotlin
67-
code: `fun containsEven(collection: Collection<Int>): Boolean = collection.any {TODO()}`,
68+
code: 'fun containsEven(collection: Collection<Int>): Boolean = collection.any {TODO()}',
6869
});
6970
});
7071

0 commit comments

Comments
 (0)