Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: Check prettier by default linter, fix code by pre-commit hook, fix release files #195

Merged
merged 4 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
node_modules
dist
/out
/build
/.idea
/node_modules
/dist
/test-results/
/playwright-report/
/playwright/
9 changes: 7 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, it works like that.

],
parser: '@typescript-eslint/parser',
parserOptions: {
Expand All @@ -19,5 +19,10 @@ module.exports = {
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'eslint-plugin-import'],
rules: {},
rules: {
quotes: ['error', 'single', {
'avoidEscape': true,
'allowTemplateLiterals': false
}]
}
};
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
5 changes: 5 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"*.ts": [
"npm run fix"
]
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint-staged requirement:

[email protected]: The engine "node" is incompatible with this module. Expected version ">=18.12.0". Got "16.20.2"

14 changes: 8 additions & 6 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Ignore everything recursively
*
# But not the .ts files
!*.ts
# Check subdirectories too
!*/
/out
/build
/.idea
/node_modules
/dist
/test-results/
/playwright-report/
/playwright/
13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"repository": "JetBrains/kotlin-playground",
"main": "dist/playground.min.js",
"files": [
"dist"
"dist",
"!dist/REMOVE_ME.js*"
],
"devDependencies": {
"@babel/cli": "^7.21.5",
Expand All @@ -36,13 +37,16 @@
"eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-prettier": "^5.0.1",
"fast-async": "7",
"fast-deep-equal": "^3.1.3",
"file-loader": "^6.2.0",
"flatten": "^1.0.2",
"github-markdown-css": "^3.0.1",
"html-webpack-plugin": "^5.5.3",
"husky": "^8.0.3",
"is-empty-object": "^1.1.1",
"lint-staged": "^15.0.2",
"lz-string": "^1.4.4",
"markdown-it": "^12.3.2",
"markdown-it-highlightjs": "^3.0.0",
Expand All @@ -53,7 +57,7 @@
"monkberry-loader": "4.0.9",
"postcss": "^8.4.31",
"postcss-loader": "^7.3.3",
"prettier": "^3.0.2",
"prettier": "^3.0.3",
"query-string": "^6.5.0",
"sass": "^1.66.0",
"sass-loader": "^13.3.2",
Expand All @@ -77,9 +81,10 @@
"release:ci": "rm -rf dist && npm run build:all && $NPM_TOKEN=%env.NPM_TOKEN% npm publish",
"start": "webpack-dev-server --port 9002",
"lint": "eslint . --ext .ts",
"prettier": "prettier --write .",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced by fix

"fix": "eslint --fix --ext .ts .",
"test": "npm run build:all && npm run test:run",
"test:run": "playwright test",
"test:server": "node tests/utlis/server/index.js"
"test:server": "node tests/utlis/server/index.js",
"prepare": "husky install"
}
}
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { config as dotenv } from 'dotenv';
import { defineConfig, devices } from '@playwright/test';
import { isKeyOfObject } from './src/utils/types';

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

const PROJECTS_LIST = {
DEV: ['Desktop Chrome'],
Expand Down
5 changes: 3 additions & 2 deletions tests/crosslink.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ ${' '}
});

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

checkLink(generateCrosslink(codeWithMark), {
//language=kotlin
code: `fun containsEven(collection: Collection<Int>): Boolean = collection.any {TODO()}`,
code: 'fun containsEven(collection: Collection<Int>): Boolean = collection.any {TODO()}',
});
});

Expand Down
Loading