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

feat: Add ESLint #13

Merged
merged 7 commits into from
Apr 2, 2024
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
13 changes: 7 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 2
root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 2
end_of_line = lf
44 changes: 44 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (C) Daniel Kuschny (Danielku15) and contributors.
* Copyright (C) Microsoft Corporation. All rights reserved.
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
*/

module.exports = {
env: {
browser: true,
es2021: true,
},
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
},
},
],
ignorePatterns: ['out/**', 'test-workspaces/**', 'src/typings/**', 'resources/**'],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'license-header'],
rules: {
indent: ['error', 2],
'linebreak-style': ['error', 'unix'],
quotes: ['error', 'single'],
semi: ['error', 'always'],
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-var-requires': 'off',
'prefer-const': ['error', { destructuring: 'all' }],
'license-header/header': ['error', './resources/license-header.js'],
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
18 changes: 12 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
ignore:
# VS Code doesn't support ESM and Chai, need to stay on chai 4.x
# https://github.com/microsoft/vscode/issues/160416
# https://github.com/microsoft/vscode/issues/130367
# https://github.com/microsoft/vscode-loader/issues/56
- dependency-name: 'chai'
110 changes: 62 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,62 @@
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read
actions: read
checks: write

jobs:
build:
name: Build and Test
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
vscode-version: ['stable', 'insiders']
vscode-platform: ['desktop']
runs-on: ${{ matrix.os }}
env:
VSCODE_TEST_VERSION: ${{matrix.vscode-version}}
VSCODE_TEST_PLATFORM: ${{matrix.vscode-platform}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- run: npm install
- run: npm run compile:test
- name: Print Test Config
run: node ./.vscode-test.mjs
env:
VSCODE_CONFIG_LOG: true
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'
- uses: dorny/test-reporter@v1
if: always()
with:
name: VS Code Test Results (${{matrix.os}}, ${{matrix.vscode-version}}, ${{matrix.vscode-platform}})
path: 'test-results/*.json'
reporter: mocha-json
on:
push:
branches:
- main
pull_request:
workflow_dispatch:

permissions:
contents: read
actions: read
checks: write

jobs:
build:
name: Build and Test
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
vscode-version: ['stable', 'insiders']
vscode-platform: ['desktop']
runs-on: ${{ matrix.os }}
env:
VSCODE_TEST_VERSION: ${{matrix.vscode-version}}
VSCODE_TEST_PLATFORM: ${{matrix.vscode-platform}}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: Install dependencies
run: npm install

- name: Compile
run: npm run compile:test

- name: Print Test Config
run: node ./.vscode-test.mjs
env:
VSCODE_CONFIG_LOG: true

- name: Run Tests (Linux)
run: xvfb-run -a npm test
if: runner.os == 'Linux'
- name: Run Tests (Win/MacOS)
run: npm test
if: runner.os != 'Linux'

- name: Run Linter
if: always()
run: npm run lint

- uses: dorny/test-reporter@v1
if: always()
with:
name: VS Code Test Results (${{matrix.os}}, ${{matrix.vscode-version}}, ${{matrix.vscode-platform}})
path: 'test-results/*.json'
reporter: mocha-json
Loading