Skip to content

Commit

Permalink
Setup prettier for consistent code formatting (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
nishtahir authored Oct 18, 2023
1 parent bad0234 commit 8ba572c
Show file tree
Hide file tree
Showing 12 changed files with 262 additions and 227 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Node.js CI

on:
push:
branches: [ master, develop ]
branches: [master, develop]
pull_request:
branches: [ master, develop ]
branches: [master, develop]

jobs:
build:
Expand All @@ -16,17 +16,17 @@ jobs:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run coverage
- name: Upload to Codecov
uses: codecov/codecov-action@v1
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test
- run: npm run coverage
- name: Upload to Codecov
uses: codecov/codecov-action@v1
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.fontLigatures": false,
"files.associations": {
"*.YAML-tmLanguage": "yaml"
}
}
24 changes: 12 additions & 12 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ orientation.
Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

### Our Responsibilities
Expand Down Expand Up @@ -71,4 +71,4 @@ This Code of Conduct is adapted from the [Contributor Covenant][homepage], versi
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[version]: http://contributor-covenant.org/version/1/4/
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ $ npm install

## Build

Changes to the grammar should be made in the `src` folder. These are merged at build
Changes to the grammar should be made in the `src` folder. These are merged at build
time and used to produce the final artifact.

Once you are satisfied with your changes, you will need to generate
`xml` and `json` variants for distribution.
Once you are satisfied with your changes, you will need to generate
`xml` and `json` variants for distribution.
There's a handy build script available to automate this process.

```
Expand All @@ -41,7 +41,7 @@ $ npm run format

> All changes to the grammar must be accompanied by tests covering relevant scopes.
Tests are run using [`vscode-tmgrammar-test`](https://github.com/PanAeon/vscode-tmgrammar-test).
Tests are run using [`vscode-tmgrammar-test`](https://github.com/PanAeon/vscode-tmgrammar-test).
Test cases and regression tests are available in the `/test` folder.

Generated snapshots are available in the `/snapshots` folder and should be updated with changes
Expand All @@ -55,9 +55,8 @@ $ npm test

## Useful resources

* [NovaLightshow](https://novalightshow.netlify.app/) - Useful for testing Grammar sources against Code to inspect the highlighting behavior. Thanks to [Nixinova](https://github.com/Nixinova/NovaLightshow)
* [Sublime Text scope naming reference](https://www.sublimetext.com/docs/3/scope_naming.html) - Reference on Textmate scope naming

- [NovaLightshow](https://novalightshow.netlify.app/) - Useful for testing Grammar sources against Code to inspect the highlighting behavior. Thanks to [Nixinova](https://github.com/Nixinova/NovaLightshow)
- [Sublime Text scope naming reference](https://www.sublimetext.com/docs/3/scope_naming.html) - Reference on Textmate scope naming

## Code of Conduct

Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build": "npm run build:grammar && npm run build:snapshot",
"format": "node scripts/format.js",
"coverage": "node scripts/coverage.js && npx codecov",
"prettier": "prettier --write .",
"test:snapshot": "npx vscode-tmgrammar-snap -g dist/Kotlin.tmLanguage -s source.kotlin \"snapshots/**/*.kt\"",
"test:grammar": "npx vscode-tmgrammar-test -g dist/Kotlin.tmLanguage \"test/**/*.test.kt\"",
"test": "npm run test:grammar && npm run test:snapshot"
Expand All @@ -28,6 +29,7 @@
"format-json": "^1.0.3",
"lcov-write": "^1.0.0",
"plist": "^3.0.6",
"prettier": "^3.0.3",
"vscode-tmgrammar-test": "^0.1.1",
"yaml": "^1.10.0",
"yaml-source-map": "^2.1.1",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ if (!fs.existsSync(destDir)) {
console.log("Generating Json file...");
fs.writeFileSync(
path.resolve(destDir, "Kotlin.JSON-tmLanguage"),
json.plain(data)
json.plain(data),
);

console.log("Generating Yaml file...");
fs.writeFileSync(
path.resolve(destDir, "Kotlin.YAML-tmLanguage"),
yaml.stringify(data, 6)
yaml.stringify(data, 6),
);

console.log("Generating Xml file...");
Expand Down
Loading

0 comments on commit 8ba572c

Please sign in to comment.