Skip to content

Commit

Permalink
chore(deps): bump dependencies, use union @1stG configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Nov 18, 2019
1 parent d45379d commit 9566ff5
Show file tree
Hide file tree
Showing 34 changed files with 8,697 additions and 2,887 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@1stg"
]
}
3 changes: 0 additions & 3 deletions .commitlintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode-test
!/.*.js
/.vscode-test
lib
node_modules
11 changes: 11 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"root": true,
"extends": "@1stg",
"settings": {
"node": {
"allowModules": [
"vscode"
]
}
}
}
14 changes: 0 additions & 14 deletions .eslintrc.js

This file was deleted.

9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
!.vscode
.vscode-test
*.log
*.tsbuildinfo
.*cache
!/.vscode
/.vscode-test
lib
node_modules
tsconfig.tsbuildinfo
*.log
6 changes: 0 additions & 6 deletions .huskyrc

This file was deleted.

1 change: 1 addition & 0 deletions .huskyrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/husky-config')
10 changes: 0 additions & 10 deletions .lintstagedrc

This file was deleted.

1 change: 1 addition & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('@1stg/lint-staged')
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"prettier-config-1stg"
"@1stg/prettier-config"
4 changes: 3 additions & 1 deletion .renovaterc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{
"extends": ["1stg"]
"extends": [
"@1stg"
]
}
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ before_install:
- git config --global user.name 'JounQin'
- git config --global user.email 'admin@1stg.me'

script:
- yarn lint
- yarn build
install: yarn --frozen-lockfile

script: yarn lint

deploy:
provider: script
skip_cleanup: true
script: bash deploy.sh
on:
branch: master
5 changes: 3 additions & 2 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.*
*.log
*.ts
*.map
*.ts
*.tsbuildinfo
deploy.sh
tsconfig.json
tsconfig.base.json
tsconfig.tsbuildinfo
node_modules
yarn.lock
!/node_modules/vscode-jsonrpc/**
Expand Down
55 changes: 49 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,56 @@ Adds language support for [MDX].

You can install this extension from the [Marketplace](https://marketplace.visualstudio.com/items?itemName=JounQin.vscode-mdx).

## What about `.md` files?
## Integration With [VS Code ESLint](https://github.com/microsoft/vscode-eslint)

By default the MDX language is applied only to `.mdx` files. If MDX files in your project end with `.md`, you can tell VS Code that by adding the following to your workspace settings:
1. First of all, you need to enable [eslint-plugin-mdx][] which makes it possible to lint `.mdx` or `.md` files with `ESLint`.

```json
"files.associations": {
"*.md": "mdx"
},
2. And then you will need to enable ESLint validation for `.mdx` and `.md` files like following:

```jsonc
// .vscode/settings.json
{
"eslint.autoFixOnSave": true,
"eslint.options": {
"extensions": [".js", ".jsx", ".md", ".mdx", ".ts", ".tsx"]
},
"eslint.validate": [
{
"language": "javascript",
"autoFix": true
},
{
"language": "javascriptreact",
"autoFix": true
},
{
"language": "markdown",
"autoFix": true
},
{
"language": "mdx",
"autoFix": true
},
{
"language": "typescript",
"autoFix": true
},
{
"language": "typescriptreact",
"autoFix": true
}
]
}
```

### Markdown Syntax

Markdown Syntax could also be linted via [eslint-plugin-mdx][] and [remark-lint][] plugins.

> it will read [remark][]'s [configuration](https://github.com/remarkjs/remark/tree/master/packages/remark-cli#remark-cli) automatically via [cosmiconfig](https://github.com/davidtheclark/cosmiconfig). But `.remarkignore` will not be respected, you should use `.eslintignore` instead.
More usage detail please refer to [eslint-plugin-mdx][]'s [documentation](https://github.com/rx-ts/eslint-mdx#toc-).

## Auto-close tags

If you want VS Code to automatically close tags while you type, you can install [Auto Close Tag](https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-close-tag) and configure it to also include the language `mdx`:
Expand All @@ -30,3 +70,6 @@ If you want VS Code to automatically close tags while you type, you can install
```

[mdx]: https://github.com/mdx-js/mdx
[eslint-plugin-mdx]: https://github.com/rx-ts/eslint-mdx
[remark]: https://github.com/remarkjs/remark
[remark-lint]: https://github.com/remarkjs/remark-lint
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"name": "vscode-mdx-client",
"version": "0.1.1",
"description": "Client of MDX extension for Visual Studio Code",
"repository": "git@github.com:rx-ts/vscode-mdx.git",
"author": "JounQin",
"publisher": "JounQin",
"license": "MIT",
"repository": "git@github.com:rx-ts/vscode-mdx.git",
"engines": {
"vscode": "^1.23.0"
"vscode": ">=1.0.0"
},
"dependencies": {
"vscode-languageclient": "^5.2.1"
Expand Down
5 changes: 2 additions & 3 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import * as path from 'path'
import path from 'path'

import {
LanguageClient,
LanguageClientOptions,
ServerOptions,
TransportKind,
} from 'vscode-languageclient'

import { workspace, ExtensionContext } from 'vscode'

let client: LanguageClient
let client: LanguageClient | undefined

export function activate(context: ExtensionContext) {
// The server is implemented in node
Expand Down
23 changes: 0 additions & 23 deletions client/src/test/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import * as assert from 'assert'
import assert from 'assert'

import { getDocUri, activate } from './helper'
import vscode from 'vscode'

import * as vscode from 'vscode'
import { getDocUri, activate } from './helper'

async function testCompletion(
docUri: vscode.Uri,
Expand Down Expand Up @@ -37,12 +37,12 @@ async function testCompletion(
describe('Should do completion', () => {
const docUri = getDocUri('completion.txt')

it('Completes JS/TS in txt file', async () => {
await testCompletion(docUri, new vscode.Position(0, 0), {
// eslint-disable-next-line jest/expect-expect
it('Completes JS/TS in txt file', () =>
testCompletion(docUri, new vscode.Position(0, 0), {
items: [
{ label: 'JavaScript', kind: vscode.CompletionItemKind.Text },
{ label: 'TypeScript', kind: vscode.CompletionItemKind.Text },
],
})
})
}))
})
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* eslint-disable @typescript-eslint/no-magic-numbers */
/* --------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import * as assert from 'assert'
import assert from 'assert'

import { getDocUri, activate } from './helper'
import vscode from 'vscode'

import * as vscode from 'vscode'
import { getDocUri, activate } from './helper'

function toRange(sLine: number, sChar: number, eLine: number, eChar: number) {
const start = new vscode.Position(sLine, sChar)
Expand Down Expand Up @@ -36,8 +37,9 @@ async function testDiagnostics(
describe('Should get diagnostics', () => {
const docUri = getDocUri('diagnostics.txt')

it('Diagnoses uppercase texts', async () => {
await testDiagnostics(docUri, [
// eslint-disable-next-line jest/expect-expect
it('Diagnoses uppercase texts', () =>
testDiagnostics(docUri, [
{
message: 'ANY is all uppercase.',
range: toRange(0, 0, 0, 3),
Expand All @@ -56,6 +58,5 @@ describe('Should get diagnostics', () => {
severity: vscode.DiagnosticSeverity.Warning,
source: 'ex',
},
])
})
]))
})
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import React from 'react'

export const Test = () => <div>Hello World</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Lorem ipsum dolor sit amet, consectetur adipiscing **elit**. Ut ac lobortis <b>v
```

<Test>{/* This is a comment */}</Test>

<Test>
{/** This is a comment */}In JSX!{/** This is a comment */}
</Test>
Expand Down
6 changes: 3 additions & 3 deletions client/src/test/helper.ts → client/test/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */

import * as path from 'path'
import path from 'path'

import * as vscode from 'vscode'
import vscode from 'vscode'

export let doc: vscode.TextDocument
export let editor: vscode.TextEditor
Expand All @@ -26,7 +26,7 @@ export async function activate(docUri: vscode.Uri) {
try {
doc = await vscode.workspace.openTextDocument(docUri)
editor = await vscode.window.showTextDocument(doc)
await sleep(2000) // Wait for server activation
await sleep(2 * 1000) // Wait for server activation
} catch (e) {
console.error(e)
}
Expand Down
19 changes: 19 additions & 0 deletions client/test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import path from 'path'

import { runTests } from 'vscode-test'

function main() {
// The folder containing the Extension Manifest package.json
// Passed to `--extensionDevelopmentPath`
const extensionDevelopmentPath = path.resolve(__dirname, '..')

// The path to the extension test script
// Passed to --extensionTestsPath
const extensionTestsPath = path.resolve(__dirname, './suite/index')

// Download VS Code, unzip it and run the integration test
return runTests({ extensionDevelopmentPath, extensionTestsPath })
}

// eslint-disable-next-line @typescript-eslint/no-floating-promises
main()
File renamed without changes.
5 changes: 2 additions & 3 deletions client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"extends": "../tsconfig.base.json",
"extends": "../tsconfig.base",
"compilerOptions": {
"composite": true,
"outDir": "lib",
"rootDir": "src"
},
"include": ["src"],
"exclude": ["src/test"]
"include": ["src"]
}
Loading

0 comments on commit 9566ff5

Please sign in to comment.