Skip to content

Commit 484a15d

Browse files
authored
Merge pull request #151 from ssshooter/v1.1.4
V1.1.4
2 parents 1403f81 + 1b40666 commit 484a15d

33 files changed

+1867
-939
lines changed

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
src/__tests__
3+
**/*.d.ts

.eslintrc.js

Lines changed: 7 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -1,176 +1,13 @@
11
module.exports = {
2+
env: {
3+
browser: true,
4+
amd: true,
5+
node: true,
6+
},
7+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
8+
plugins: ['@typescript-eslint'],
29
parser: '@typescript-eslint/parser',
310
parserOptions: {
411
sourceType: 'module',
512
},
6-
rules: {
7-
'accessor-pairs': 2,
8-
'arrow-spacing': [2, {
9-
'before': true,
10-
'after': true,
11-
}],
12-
'block-spacing': [2, 'always'],
13-
'brace-style': [2, '1tbs', {
14-
'allowSingleLine': true,
15-
}],
16-
'camelcase': [0, {
17-
'properties': 'always',
18-
}],
19-
'comma-dangle': ['error', 'always-multiline'],
20-
'comma-spacing': [2, {
21-
'before': false,
22-
'after': true,
23-
}],
24-
'comma-style': [2, 'last'],
25-
'constructor-super': 2,
26-
'curly': [2, 'multi-line'],
27-
'dot-location': [2, 'property'],
28-
'eol-last': 2,
29-
'eqeqeq': ['error', 'always', { 'null': 'ignore' }],
30-
'generator-star-spacing': [2, {
31-
'before': true,
32-
'after': true,
33-
}],
34-
'handle-callback-err': [2, '^(err|error)$'],
35-
'indent': [2, 2, {
36-
'SwitchCase': 1,
37-
}],
38-
'jsx-quotes': [2, 'prefer-single'],
39-
'key-spacing': [2, {
40-
'beforeColon': false,
41-
'afterColon': true,
42-
}],
43-
'keyword-spacing': [2, {
44-
'before': true,
45-
'after': true,
46-
}],
47-
'new-cap': [2, {
48-
'newIsCap': true,
49-
'capIsNew': false,
50-
}],
51-
'new-parens': 2,
52-
'no-array-constructor': 2,
53-
'no-caller': 2,
54-
'no-console': 'off',
55-
'no-class-assign': 2,
56-
'no-cond-assign': 2,
57-
'no-const-assign': 2,
58-
'no-control-regex': 0,
59-
'no-delete-var': 2,
60-
'no-dupe-args': 2,
61-
'no-dupe-class-members': 2,
62-
'no-dupe-keys': 2,
63-
'no-duplicate-case': 2,
64-
'no-empty-character-class': 2,
65-
'no-empty-pattern': 2,
66-
'no-eval': 2,
67-
'no-ex-assign': 2,
68-
'no-extend-native': 2,
69-
'no-extra-bind': 2,
70-
'no-extra-boolean-cast': 2,
71-
'no-extra-parens': [2, 'functions'],
72-
'no-fallthrough': 2,
73-
'no-floating-decimal': 2,
74-
'no-func-assign': 2,
75-
'no-implied-eval': 2,
76-
'no-inner-declarations': [2, 'functions'],
77-
'no-invalid-regexp': 2,
78-
'no-irregular-whitespace': 2,
79-
'no-iterator': 2,
80-
'no-label-var': 2,
81-
'no-labels': [2, {
82-
'allowLoop': false,
83-
'allowSwitch': false,
84-
}],
85-
'no-lone-blocks': 2,
86-
'no-mixed-spaces-and-tabs': 2,
87-
'no-multi-spaces': 2,
88-
'no-multi-str': 2,
89-
'no-multiple-empty-lines': [2, {
90-
'max': 1,
91-
}],
92-
'no-native-reassign': 2,
93-
'no-negated-in-lhs': 2,
94-
'no-new-object': 2,
95-
'no-new-require': 2,
96-
'no-new-symbol': 2,
97-
'no-new-wrappers': 2,
98-
'no-obj-calls': 2,
99-
'no-octal': 2,
100-
'no-octal-escape': 2,
101-
'no-path-concat': 2,
102-
'no-proto': 2,
103-
'no-redeclare': 2,
104-
'no-regex-spaces': 2,
105-
'no-return-assign': [2, 'except-parens'],
106-
'no-self-assign': 2,
107-
'no-self-compare': 2,
108-
'no-sequences': 2,
109-
'no-shadow-restricted-names': 2,
110-
'no-spaced-func': 2,
111-
'no-sparse-arrays': 2,
112-
'no-this-before-super': 2,
113-
'no-throw-literal': 2,
114-
'no-trailing-spaces': 2,
115-
'no-undef-init': 2,
116-
'no-unexpected-multiline': 2,
117-
'no-unmodified-loop-condition': 2,
118-
'no-unneeded-ternary': [2, {
119-
'defaultAssignment': false,
120-
}],
121-
'no-unreachable': 2,
122-
'no-unsafe-finally': 2,
123-
'no-unused-vars': [2, {
124-
'vars': 'all',
125-
'args': 'none',
126-
}],
127-
'no-useless-call': 2,
128-
'no-useless-computed-key': 2,
129-
'no-useless-constructor': 2,
130-
'no-useless-escape': 0,
131-
'no-whitespace-before-property': 2,
132-
'no-with': 2,
133-
'one-var': [2, {
134-
'initialized': 'never',
135-
}],
136-
'operator-linebreak': [2, 'after', {
137-
'overrides': {
138-
'?': 'before',
139-
':': 'before',
140-
},
141-
}],
142-
'padded-blocks': [2, 'never'],
143-
'quotes': [2, 'single', {
144-
'avoidEscape': true,
145-
'allowTemplateLiterals': true,
146-
}],
147-
'semi': [2, 'never'],
148-
'semi-spacing': [2, {
149-
'before': false,
150-
'after': true,
151-
}],
152-
'space-before-blocks': [2, 'always'],
153-
'space-before-function-paren': [2, 'never'],
154-
'space-in-parens': [2, 'never'],
155-
'space-infix-ops': 2,
156-
'space-unary-ops': [2, {
157-
'words': true,
158-
'nonwords': false,
159-
}],
160-
'spaced-comment': [2, 'always', {
161-
'markers': ['global', 'globals', 'eslint', 'eslint-disable', '*package', '!', ','],
162-
}],
163-
'template-curly-spacing': [2, 'never'],
164-
'use-isnan': 2,
165-
'valid-typeof': 2,
166-
'wrap-iife': [2, 'any'],
167-
'yield-star-spacing': [2, 'both'],
168-
'yoda': [2, 'never'],
169-
'prefer-const': 2,
170-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
171-
'object-curly-spacing': [2, 'always', {
172-
objectsInObjects: false,
173-
}],
174-
'array-bracket-spacing': [2, 'never'],
175-
},
17613
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ yarn-error.log*
2121
*.njsproj
2222
*.sln
2323
*.sw?
24+
25+
.eslintcache

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.prettierrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"semi": false,
55
"singleQuote": true,
66
"arrowParens": "avoid",
7-
"printWidth": 150
7+
"printWidth": 150,
8+
"endOfLine": "auto"
89
}

commitlint.config.js

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
module.exports = {
2+
parserPreset: 'conventional-changelog-conventionalcommits',
3+
rules: {
4+
'body-leading-blank': [1, 'always'],
5+
'body-max-line-length': [2, 'always', 100],
6+
'footer-leading-blank': [1, 'always'],
7+
'footer-max-line-length': [2, 'always', 100],
8+
'header-max-length': [2, 'always', 100],
9+
'subject-case': [2, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']],
10+
'subject-empty': [2, 'never'],
11+
'subject-full-stop': [2, 'never', '.'],
12+
'type-case': [2, 'always', 'lower-case'],
13+
'type-empty': [2, 'never'],
14+
'type-enum': [2, 'always', ['build', 'chore', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'style', 'test']],
15+
},
16+
prompt: {
17+
questions: {
18+
type: {
19+
description: "Select the type of change that you're committing",
20+
enum: {
21+
feat: {
22+
description: 'A new feature',
23+
title: 'Features',
24+
emoji: '✨',
25+
},
26+
fix: {
27+
description: 'A bug fix',
28+
title: 'Bug Fixes',
29+
emoji: '🐛',
30+
},
31+
docs: {
32+
description: 'Documentation only changes',
33+
title: 'Documentation',
34+
emoji: '📚',
35+
},
36+
style: {
37+
description: 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
38+
title: 'Styles',
39+
emoji: '💎',
40+
},
41+
refactor: {
42+
description: 'A code change that neither fixes a bug nor adds a feature',
43+
title: 'Code Refactoring',
44+
emoji: '📦',
45+
},
46+
perf: {
47+
description: 'A code change that improves performance',
48+
title: 'Performance Improvements',
49+
emoji: '🚀',
50+
},
51+
test: {
52+
description: 'Adding missing tests or correcting existing tests',
53+
title: 'Tests',
54+
emoji: '🚨',
55+
},
56+
build: {
57+
description: 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
58+
title: 'Builds',
59+
emoji: '🛠',
60+
},
61+
ci: {
62+
description: 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
63+
title: 'Continuous Integrations',
64+
emoji: '⚙️',
65+
},
66+
chore: {
67+
description: "Other changes that don't modify src or test files",
68+
title: 'Chores',
69+
emoji: '♻️',
70+
},
71+
revert: {
72+
description: 'Reverts a previous commit',
73+
title: 'Reverts',
74+
emoji: '🗑',
75+
},
76+
},
77+
},
78+
scope: {
79+
description: 'What is the scope of this change (e.g. component or file name)',
80+
},
81+
subject: {
82+
description: 'Write a short, imperative tense description of the change',
83+
},
84+
body: {
85+
description: 'Provide a longer description of the change',
86+
},
87+
isBreaking: {
88+
description: 'Are there any breaking changes?',
89+
},
90+
breakingBody: {
91+
description: 'A BREAKING CHANGE commit requires a body. Please enter a longer description of the commit itself',
92+
},
93+
breaking: {
94+
description: 'Describe the breaking changes',
95+
},
96+
isIssueAffected: {
97+
description: 'Does this change affect any open issues?',
98+
},
99+
issuesBody: {
100+
description: 'If issues are closed, the commit requires a body. Please enter a longer description of the commit itself',
101+
},
102+
issues: {
103+
description: 'Add issue references (e.g. "fix #123", "re #123".)',
104+
},
105+
},
106+
},
107+
}

package.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"description": "Mind elixir is a free open source mind map core.",
55
"main": "dist/MindElixir.js",
66
"scripts": {
7+
"prepare": "husky install",
8+
"lint": "eslint --cache --max-warnings 0 \"src/**/*.{js,json,ts}\" --fix",
79
"start": "webpack-dev-server --mode development --env dist=0",
810
"startd": "webpack-dev-server --mode development --env dist=1",
911
"test": "jest --runInBand",
@@ -13,6 +15,11 @@
1315
"publish2": "npm run build && npm version patch -m \"build: release %s\" && npm publish",
1416
"beta": "npm run build && npm publish --tag beta"
1517
},
18+
"lint-staged": {
19+
"src/**/*.{ts,js,json}": [
20+
"eslint --cache --fix"
21+
]
22+
},
1623
"files": [
1724
"package.json",
1825
"dist"
@@ -29,20 +36,28 @@
2936
"@babel/plugin-transform-runtime": "^7.12.10",
3037
"@babel/preset-env": "^7.11.5",
3138
"@babel/runtime": "^7.15.4",
32-
"@typescript-eslint/parser": "^5.0.0",
39+
"@commitlint/cli": "^17.4.3",
40+
"@commitlint/config-conventional": "^17.4.3",
41+
"@typescript-eslint/eslint-plugin": "^5.52.0",
42+
"@typescript-eslint/parser": "^5.52.0",
3343
"babel-loader": "^8.0.6",
3444
"better-docs": "^2.3.2",
3545
"canvg": "^3.0.6",
3646
"css-loader": "^6.7.1",
3747
"docdash": "^1.1.1",
38-
"eslint": "^8.0.0",
48+
"eslint": "^8.34.0",
49+
"eslint-config-prettier": "^8.6.0",
50+
"eslint-plugin-prettier": "^4.2.1",
3951
"file-loader": "^6.2.0",
4052
"html-webpack-plugin": "^5.3.2",
53+
"husky": "^8.0.3",
4154
"jest": "^27.5.1",
4255
"jsdoc": "^3.6.3",
4356
"jsdoc-to-markdown": "^7.1.1",
4457
"less": "^4.1.2",
4558
"less-loader": "^10.2.0",
59+
"lint-staged": "^13.1.2",
60+
"prettier": "2.8.4",
4661
"puppeteer": "^13.5.1",
4762
"puppeteer-to-istanbul": "^1.4.0",
4863
"regenerator-runtime": "^0.13.7",

readme.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ let options = {
120120
toolBar: true, // default true
121121
nodeMenu: true, // default true
122122
keypress: true, // default true
123-
locale: 'en', // [zh_CN,zh_TW,en,ja,pt] waiting for PRs
123+
locale: 'en', // [zh_CN,zh_TW,en,ja,pt,ru] waiting for PRs
124124
overflowHidden: false, // default false
125125
primaryLinkStyle: 2, // [1,2] default 1
126126
primaryNodeVerticalGap: 15, // default 25
@@ -175,6 +175,11 @@ nodeData = {
175175
tags: ['Tag'],
176176
icons: ['😀'],
177177
hyperLink: 'https://github.com/ssshooter/mind-elixir-core',
178+
image: {
179+
url: 'https://raw.githubusercontent.com/ssshooter/mind-elixir-core/master/images/logo.png', // required
180+
height: 90, // required
181+
width: 300, // required
182+
},
178183
children: [
179184
{
180185
topic: 'child',

0 commit comments

Comments
 (0)