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

chore: upgrade dev tools #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
lib
*.d.ts
51 changes: 51 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
parser: '@typescript-eslint/parser'

parserOptions:
ecmaVersion: 2018
sourceType: module

env:
browser: true
es6: true
node: true
mocha: true

plugins:
- import

extends:
- eslint:recommended
- plugin:prettier/recommended

globals:
monaco: readonly

rules:
# 0 = off, 1 = warn, 2 = error
'space-before-function-paren': 0
'no-useless-constructor': 2
'no-undef': 2
'no-console': [2, { allow: ['error', 'warn', 'info']}]
'comma-dangle': ['error', 'only-multiline']
'no-unused-vars': 0
'no-var': 2
'one-var-declaration-per-line': 2
'prefer-const': 2
'no-const-assign': 2
'no-duplicate-imports': 2
'no-use-before-define': [2, { 'functions': false, 'classes': false }]
'eqeqeq': [2, 'always', { 'null': 'ignore' }]
'no-case-declarations': 0
'no-restricted-syntax': [2, {
'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]',
'message': Don't compare for equality against boolean literals
}]

'import/first': 2
'import/newline-after-import': 2

'sonarjs/cognitive-complexity': 0
'sonarjs/no-duplicate-string': 0
'sonarjs/no-big-function': 0
'sonarjs/no-identical-functions': 0
'sonarjs/no-small-switch': 0
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist/
*.log
lib/
local/
.cache-eslint/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "12"
- stable
install: "yarn install"
before_deploy: "yarn build"
cache: yarn
Expand Down
7 changes: 0 additions & 7 deletions babel.config.js

This file was deleted.

3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
}
38 changes: 38 additions & 0 deletions example/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as monaco from 'monaco-editor'

import { initVimMode } from '../src'

const editorNode = document.getElementById('editor1')
const statusNode = document.getElementById('status1')
const editor = monaco.editor.create(editorNode, {
value: [1, 2, 3, 4, 5, 6, 7, 8].map((t) => 'import').join('\n'),
minimap: {
enabled: false,
},
theme: 'vs',
language: 'javascript',
fontSize: 15,
scrollBeyondLastLine: false,
})
editor.focus()
const vimMode = initVimMode(editor, statusNode)

const editorNode2 = document.getElementById('editor2')
const statusNode2 = document.getElementById('status2')
const editor2 = monaco.editor.create(editorNode2, {
value: [1, 2, 3, 4, 5, 6, 7, 8].map((t) => 'import').join('\n'),
minimap: {
enabled: false,
},
theme: 'vs',
language: 'javascript',
fontSize: 15,
scrollBeyondLastLine: false,
})
editor.focus()
const vimMode2 = initVimMode(editor2, statusNode2)

window.editor = editor
window.vimMode = vimMode
window.editor2 = editor
window.vimMode2 = vimMode2
File renamed without changes.
63 changes: 45 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,75 @@
"name": "monaco-vim",
"version": "0.1.4",
"description": "Vim keybindings for monaco-editor",
"types": "./lib/index.d.ts",
"main": "./lib/index.js",
"files": [
"lib",
"src"
],
"scripts": {
"test": "echo \"No test in this repo\"",
"start": "webpack-dev-server --mode development --host=0.0.0.0 --port=8080",
"lint": "eslint . --ext .js,.ts --cache --cache-location ./.cache-eslint/",
"clean": "rm -rf lib dist local",
"dist": "webpack --mode production",
"babel": "NODE_ENV=production babel ./src -d lib --ignore src/demo.js",
"build": "npm run clean && npm run babel && npm run dist",
"build": "npm run clean && tsc && npm run dist",
"local": "mkdir -p local && cp -r lib dist package.json local",
"prepublishOnly": "npm run build"
},
"keywords": [
"monaco-editor",
"vim"
],
"files": [
"dist",
"lib",
"src",
"LICENSE",
"LICENSE.codemirror.txt",
"README.md"
],
"author": "Brijesh Bittu <[email protected]> (http://bitwiser.in/)",
"license": "MIT",
"devDependencies": {
"@babel/cli": "^7.7.0",
"@babel/core": "^7.7.2",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-env": "^7.7.1",
"babel-loader": "^8.0.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@typescript-eslint/eslint-plugin": "^2.13.0",
"@typescript-eslint/parser": "^2.13.0",
"css-loader": "^3.2.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.8.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-prettier": "^3.1.2",
"file-loader": "^5.0.2",
"html-webpack-plugin": "^3.2.0",
"monaco-editor": "0.18.1",
"monaco-editor-webpack-plugin": "^1.7.0",
"husky": "^3.1.0",
"lint-staged": "^9.5.0",
"monaco-editor": "0.19.0",
"monaco-editor-webpack-plugin": "^1.8.1",
"prettier": "^1.19.1",
"style-loader": "^1.0.0",
"ts-loader": "^6.2.1",
"typescript": "^3.7.4",
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.9.0"
},
"peerDependencies": {
"monaco-editor": "^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0"
"monaco-editor": "^0.19.0"
},
"lint-staged": {
"*.@(ts|tsx|js|jsx)": [
"prettier --write",
"yarn lint --fix",
"git add"
]
},
"prettier": {
"printWidth": 120,
"semi": false,
"trailingComma": "all",
"singleQuote": true,
"arrowParens": "always",
"parser": "typescript"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "lint-staged"
}
}
}
11 changes: 11 additions & 0 deletions src/cm/keymap_vim.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { editor } from 'monaco-editor'

export default class VimMode {
constructor(editor: editor.IStandaloneCodeEditor)

attach(): void

on(key: string, callback: any): void

setStatusBar(bar: any): void
}
Loading