Skip to content

Commit

Permalink
feat(typescript): move to typescript and fix eslint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ph1p committed Aug 31, 2021
1 parent dd6a1d0 commit f4d73c8
Show file tree
Hide file tree
Showing 20 changed files with 9,795 additions and 5,112 deletions.
181 changes: 181 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
module.exports = {
extends: ['prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: ['tsconfig.test.json'],
sourceType: 'module'
},
plugins: ['prefer-arrow', '@typescript-eslint', 'import', 'jest'],
rules: {
'import/order': [
'error',
{
pathGroups: [
{
pattern: '^[a-zA-Z]',
group: 'builtin',
position: 'after'
}
],
pathGroupsExcludedImportTypes: ['builtin'],
groups: [['builtin', 'external'], 'internal', 'parent', 'sibling'],
'newlines-between': 'always',
alphabetize: {
order: 'asc'
}
}
],
'@typescript-eslint/adjacent-overload-signatures': 'error',
'@typescript-eslint/array-type': [
'error',
{
default: 'array'
}
],
'@typescript-eslint/ban-types': [
'error',
{
types: {
Object: {
message: 'Avoid using the `Object` type. Did you mean `object`?'
},
Function: {
message: 'Avoid using the `Function` type. Prefer a specific function type, like `() => void`.'
},
Boolean: {
message: 'Avoid using the `Boolean` type. Did you mean `boolean`?'
},
Number: {
message: 'Avoid using the `Number` type. Did you mean `number`?'
},
String: {
message: 'Avoid using the `String` type. Did you mean `string`?'
},
Symbol: {
message: 'Avoid using the `Symbol` type. Did you mean `symbol`?'
}
}
}
],
'@typescript-eslint/consistent-type-assertions': 'error',
'@typescript-eslint/dot-notation': 'error',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/member-delimiter-style': [
'off',
{
multiline: {
delimiter: 'none',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
}
}
],
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-parameter-properties': 'off',
'@typescript-eslint/no-shadow': [
'error',
{
hoist: 'all'
}
],
'@typescript-eslint/no-this-alias': 'error',
'@typescript-eslint/no-unused-expressions': 'error',
'@typescript-eslint/no-use-before-define': 'off',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'error',
'@typescript-eslint/prefer-function-type': 'error',
'@typescript-eslint/prefer-namespace-keyword': 'error',
'@typescript-eslint/quotes': 'off',
'@typescript-eslint/semi': ['off', null],
'@typescript-eslint/triple-slash-reference': [
'error',
{
path: 'always',
types: 'prefer-import',
lib: 'always'
}
],
'@typescript-eslint/type-annotation-spacing': 'off',
'@typescript-eslint/unified-signatures': 'error',
'arrow-parens': ['off', 'always'],
'brace-style': ['off', 'off'],
'comma-dangle': 'off',
complexity: 'off',
'constructor-super': 'error',
'eol-last': 'off',
eqeqeq: ['error', 'smart'],
'guard-for-in': 'error',
'id-blacklist': [
'error',
'any',
'Number',
'number',
'String',
'string',
'Boolean',
'boolean',
'Undefined',
'undefined'
],
'id-match': 'error',
'linebreak-style': 'off',
'max-classes-per-file': ['error', 1],
'max-len': 'off',
'new-parens': 'off',
'newline-per-chained-call': 'off',
'no-bitwise': 'error',
'no-caller': 'error',
'no-cond-assign': 'error',
'no-console': 'off',
'no-debugger': 'error',
'no-duplicate-case': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'off',
'no-eval': 'error',
'no-extra-bind': 'error',
'no-extra-semi': 'off',
'no-fallthrough': 'off',
'no-invalid-this': 'off',
'no-irregular-whitespace': 'off',
'no-multiple-empty-lines': 'off',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-redeclare': 'error',
'no-return-await': 'error',
'no-sequences': 'error',
'no-sparse-arrays': 'error',
'no-template-curly-in-string': 'error',
'no-throw-literal': 'error',
'no-trailing-spaces': 'off',
'no-undef-init': 'error',
'no-underscore-dangle': 'error',
'no-unsafe-finally': 'error',
'no-unused-labels': 'error',
'no-var': 'error',
'object-shorthand': 'error',
'one-var': ['error', 'never'],
'prefer-arrow/prefer-arrow-functions': 'error',
'prefer-const': 'error',
'prefer-object-spread': 'error',
'quote-props': 'off',
radix: 'error',
'space-before-function-paren': 'off',
'space-in-parens': ['off', 'never'],
'spaced-comment': [
'error',
'always',
{
markers: ['/']
}
],
'use-isnan': 'error',
'valid-typeof': 'off'
}
};
File renamed without changes.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
# for Jetbrains IDEA ides
.idea
coverage
.now
.now
dist
11 changes: 11 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
presets: [
[
'@babel/preset-env',
{
targets: { node: 'current' }
}
],
'@babel/preset-typescript'
]
};
27 changes: 2 additions & 25 deletions bin/vuepress-jsdoc.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,5 @@
#!/usr/bin/env node
'use strict';

const { program } = require('commander');

const { generate } = require('../cmds');
Object.defineProperty(exports, '__esModule', { value: true });
const { version } = require('../package.json');

program.version(version).description('a CLI Tool to generate markdown files for vuepress');

program
.description('Generate the md files')
.option('-s, --source <string>', 'Source folder with .js or .ts files', './src')
.option('-d, --dist <string>', 'Destination folder', './documentation')
.option('-f, --folder <string>', 'Folder inside destination folder. Gets overwritten everytime', 'code')
.option('-t, --title <string>', 'Title of your documentation', 'API')
.option('-r, --readme <string>', 'Path to your custom readme')
.option('-e, --exclude <string>', 'Pattern to exclude files/folders (Comma seperated) - *.test.js,exclude.js')
.option(
'-rm, --rmPattern [files...]',
'Pattern when removing files. You can ex- and include files. (glob pattern)',
[]
)
.option('-p, --partials [files...]', 'jsdoc2markdown partial templates (overwrites default ones)', [])
.option('-c, --jsDocConfigPath <string>', 'Path to jsdoc config')
.action(generate);

program.parse(process.argv);
require('../dist/cmds').default(version);
58 changes: 1 addition & 57 deletions example/documentation/code/config.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 0 additions & 26 deletions helpers/comment-parser.js

This file was deleted.

Loading

0 comments on commit f4d73c8

Please sign in to comment.