Skip to content

Commit 8abffb4

Browse files
committed
chore: upgrade dev tools
1 parent 891972e commit 8abffb4

18 files changed

+6005
-4368
lines changed

.eslintignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
lib

.eslintrc.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
parser: '@typescript-eslint/parser'
2+
3+
parserOptions:
4+
ecmaVersion: 2018
5+
sourceType: module
6+
7+
env:
8+
browser: true
9+
es6: true
10+
node: true
11+
mocha: true
12+
13+
plugins:
14+
- import
15+
16+
extends:
17+
- eslint:recommended
18+
- plugin:prettier/recommended
19+
20+
globals:
21+
monaco: readonly
22+
23+
rules:
24+
# 0 = off, 1 = warn, 2 = error
25+
'space-before-function-paren': 0
26+
'no-useless-constructor': 2
27+
'no-undef': 2
28+
'no-console': [2, { allow: ['error', 'warn', 'info']}]
29+
'comma-dangle': ['error', 'only-multiline']
30+
'no-unused-vars': 0
31+
'no-var': 2
32+
'one-var-declaration-per-line': 2
33+
'prefer-const': 2
34+
'no-const-assign': 2
35+
'no-duplicate-imports': 2
36+
'no-use-before-define': [2, { 'functions': false, 'classes': false }]
37+
'eqeqeq': [2, 'always', { 'null': 'ignore' }]
38+
'no-case-declarations': 0
39+
'no-restricted-syntax': [2, {
40+
'selector': 'BinaryExpression[operator=/(==|===|!=|!==)/][left.raw=true], BinaryExpression[operator=/(==|===|!=|!==)/][right.raw=true]',
41+
'message': Don't compare for equality against boolean literals
42+
}]
43+
44+
'import/first': 2
45+
'import/newline-after-import': 2
46+
47+
'sonarjs/cognitive-complexity': 0
48+
'sonarjs/no-duplicate-string': 0
49+
'sonarjs/no-big-function': 0
50+
'sonarjs/no-identical-functions': 0
51+
'sonarjs/no-small-switch': 0

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ dist/
33
*.log
44
lib/
55
local/
6+
.cache-eslint/

babel.config.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
module.exports = {
22
presets: ['@babel/preset-env'],
3-
plugins: [
4-
'@babel/plugin-syntax-dynamic-import',
5-
'transform-class-properties',
6-
]
3+
plugins: ['@babel/plugin-syntax-dynamic-import', 'transform-class-properties'],
74
}

commitlint.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
}

example/demo.js

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import * as monaco from 'monaco-editor'
2+
3+
import { initVimMode } from '../src'
4+
5+
const editorNode = document.getElementById('editor1')
6+
const statusNode = document.getElementById('status1')
7+
const editor = monaco.editor.create(editorNode, {
8+
value: [1, 2, 3, 4, 5, 6, 7, 8].map((t) => 'import').join('\n'),
9+
minimap: {
10+
enabled: false,
11+
},
12+
theme: 'vs',
13+
language: 'javascript',
14+
fontSize: 15,
15+
scrollBeyondLastLine: false,
16+
})
17+
editor.focus()
18+
const vimMode = initVimMode(editor, statusNode)
19+
20+
const editorNode2 = document.getElementById('editor2')
21+
const statusNode2 = document.getElementById('status2')
22+
const editor2 = monaco.editor.create(editorNode2, {
23+
value: [1, 2, 3, 4, 5, 6, 7, 8].map((t) => 'import').join('\n'),
24+
minimap: {
25+
enabled: false,
26+
},
27+
theme: 'vs',
28+
language: 'javascript',
29+
fontSize: 15,
30+
scrollBeyondLastLine: false,
31+
})
32+
editor.focus()
33+
const vimMode2 = initVimMode(editor2, statusNode2)
34+
35+
window.editor = editor
36+
window.vimMode = vimMode
37+
window.editor2 = editor
38+
window.vimMode2 = vimMode2
File renamed without changes.

package.json

+40-11
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
"description": "Vim keybindings for monaco-editor",
55
"main": "./lib/index.js",
66
"scripts": {
7-
"test": "echo \"No test in this repo\"",
87
"start": "webpack-dev-server --mode development --host=0.0.0.0 --port=8080",
8+
"lint": "eslint . --ext .js,.ts --cache --cache-location ./.cache-eslint/",
99
"clean": "rm -rf lib dist local",
1010
"dist": "webpack --mode production",
1111
"babel": "NODE_ENV=production babel ./src -d lib --ignore src/demo.js",
12-
"build": "npm run clean && npm run babel && npm run dist",
12+
"build": "npm run clean && tsc && npm run dist",
1313
"local": "mkdir -p local && cp -r lib dist package.json local",
1414
"prepublishOnly": "npm run build"
1515
},
@@ -28,22 +28,51 @@
2828
"author": "Brijesh Bittu <[email protected]> (http://bitwiser.in/)",
2929
"license": "MIT",
3030
"devDependencies": {
31-
"@babel/cli": "^7.7.0",
32-
"@babel/core": "^7.7.2",
33-
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
34-
"@babel/preset-env": "^7.7.1",
35-
"babel-loader": "^8.0.6",
36-
"babel-plugin-transform-class-properties": "^6.24.1",
31+
"@commitlint/cli": "^8.2.0",
32+
"@commitlint/config-conventional": "^8.2.0",
33+
"@typescript-eslint/eslint-plugin": "^2.13.0",
34+
"@typescript-eslint/parser": "^2.13.0",
3735
"css-loader": "^3.2.0",
36+
"eslint": "^6.8.0",
37+
"eslint-config-prettier": "^6.8.0",
38+
"eslint-plugin-import": "^2.19.1",
39+
"eslint-plugin-prettier": "^3.1.2",
40+
"file-loader": "^5.0.2",
3841
"html-webpack-plugin": "^3.2.0",
39-
"monaco-editor": "0.18.1",
40-
"monaco-editor-webpack-plugin": "^1.7.0",
42+
"husky": "^3.1.0",
43+
"lint-staged": "^9.5.0",
44+
"monaco-editor": "0.19.0",
45+
"monaco-editor-webpack-plugin": "^1.8.1",
46+
"prettier": "^1.19.1",
4147
"style-loader": "^1.0.0",
48+
"ts-loader": "^6.2.1",
49+
"typescript": "^3.7.4",
4250
"webpack": "^4.41.2",
4351
"webpack-cli": "^3.3.10",
4452
"webpack-dev-server": "^3.9.0"
4553
},
4654
"peerDependencies": {
47-
"monaco-editor": "^0.14.0 || ^0.15.0 || ^0.16.0 || ^0.17.0 || ^0.18.0"
55+
"monaco-editor": "^0.19.0"
56+
},
57+
"lint-staged": {
58+
"*.@(ts|tsx|js|jsx)": [
59+
"prettier --write",
60+
"yarn lint -- --fix",
61+
"git add"
62+
]
63+
},
64+
"prettier": {
65+
"printWidth": 120,
66+
"semi": false,
67+
"trailingComma": "all",
68+
"singleQuote": true,
69+
"arrowParens": "always",
70+
"parser": "typescript"
71+
},
72+
"husky": {
73+
"hooks": {
74+
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
75+
"pre-commit": "lint-staged"
76+
}
4877
}
4978
}

0 commit comments

Comments
 (0)