Skip to content

Commit

Permalink
chore: prettier, husky, lint-staged, commitlint and commitizen
Browse files Browse the repository at this point in the history
  • Loading branch information
regchiu committed May 24, 2024
1 parent c8b9fee commit 579b229
Show file tree
Hide file tree
Showing 22 changed files with 4,503 additions and 1,795 deletions.
16 changes: 4 additions & 12 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,16 @@
module.exports = {
root: true,
extends: [
'eslint:recommended',
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/stylistic',
],
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
'@stylistic'
],
plugins: ['@typescript-eslint', '@stylistic'],
rules: {
'@stylistic/indent': ['error', 2],
'@stylistic/semi': ['error', 'never'],
'@stylistic/quotes': ['error', 'single', { 'allowTemplateLiterals': true }]
'@stylistic/quotes': ['error', 'single', { allowTemplateLiterals: true }],
},
ignorePatterns: [
'media',
'out',
'dist',
'**/*.d.ts'
]
ignorePatterns: ['media', 'out', 'dist', '**/*.d.ts'],
}
34 changes: 17 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
- main
release:
types:
- created
- created

jobs:
build:
Expand All @@ -13,19 +13,19 @@ jobs:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
- name: Publish
if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm install
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
- name: Publish
if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
run: npm run deploy
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
node_modules
.vscode-test/
*.vsix
.DS_Store
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
1 change: 1 addition & 0 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exec < /dev/tty && node_modules/.bin/cz --hook || true
3 changes: 3 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"**/*": "prettier --write --ignore-unknown"
}
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build
coverage
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 100,
"useTabs": false,
"quoteProps": "as-needed",
"jsxSingleQuote": false,
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"arrowParens": "always",
"singleAttributePerLine": true,
"endOfLine": "lf"
}
6 changes: 3 additions & 3 deletions .vscode-test.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineConfig } from '@vscode/test-cli';
import { defineConfig } from '@vscode/test-cli'

export default defineConfig({
files: 'out/test/**/*.test.js',
});
files: 'out/test/**/*.test.js',
})
5 changes: 1 addition & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"dbaeumer.vscode-eslint",
"ms-vscode.extension-test-runner"
]
"recommendations": ["dbaeumer.vscode-eslint", "ms-vscode.extension-test-runner"]
}
8 changes: 2 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
"name": "Run Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/out/**/*.js"],
"preLaunchTask": "${defaultBuildTask}"
}
]
Expand Down
9 changes: 4 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
{
"files.exclude": {
"out": false // set this to true to hide the "out" folder with the compiled JS files
},
},
"search.exclude": {
"out": true // set this to false to include "out" folder in search results
},
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"cSpell.words": [
"dotlottie",
"lottiefiles"
]
"cSpell.words": ["dotlottie", "lottiefiles"],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ Preview Lottie in Visual Studio Code.

- Open `.lottie` file directly.
![feature 2](media/images/vscode-lottie-preview-feature-2.gif)

1 change: 1 addition & 0 deletions commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ['@commitlint/config-conventional'] }
2 changes: 1 addition & 1 deletion media/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const dotlottiePlayer = document.querySelector('.dotlottie-player')
let dotlottiePlayerWidth = '300px'
let dotlottiePlayerHeight = '300px'

const widthInput = document.querySelector("#width")
const widthInput = document.querySelector('#width')
widthInput.addEventListener('input', (e) => {
dotlottiePlayerWidth = e.target.value
dotlottiePlayer.style = `width: ${dotlottiePlayerWidth}; height: ${dotlottiePlayerHeight}`
Expand Down
Loading

0 comments on commit 579b229

Please sign in to comment.