Skip to content

Commit

Permalink
refactor: linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhadip committed Sep 3, 2022
1 parent 14a06f5 commit b04368e
Show file tree
Hide file tree
Showing 15 changed files with 7,094 additions and 538 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = tabs
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
format_on_save = true
11 changes: 11 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build/
node_modules/
src/shims-tsx.d.ts
src/shims-vue.d.ts
*.config.js
src/main.ts
test/
dist/*.hot-update.json
dist/index.html
dist/webpack-stats.json
tests/
45 changes: 45 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module.exports = {
parser: '@typescript-eslint/parser', // add the TypeScript parser
plugins: [
'svelte3',
'@typescript-eslint' // add the TypeScript plugin
],
env: {
es6: true,
browser: true
},
overrides: [ // this stays the same
{
files: ['*.svelte'],
processor: 'svelte3/svelte3'
},{
files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
env: {
jest: true,
},
},
],
rules: {
"@typescript-eslint/no-floating-promises": "warn"

},
settings: {
'svelte3/typescript': true, // load TypeScript as peer dependency
// ignore style tags in Svelte because of Tailwind CSS
// See https://github.com/sveltejs/eslint-plugin-svelte3/issues/70
'svelte3/ignore-styles': () => true
},
parserOptions: { // add these parser options
ecmaVersion: 2020,
sourceType: 'module',
tsconfigRootDir: __dirname,
project: ['./tsconfig.json'],
extraFileExtensions: ['.svelte'],
},
extends: [ // then, enable whichever type-aware rules you want to use
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
ignorePatterns: ['node_modules']
};
5 changes: 5 additions & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# run lint-staged command
npx lint-staged
30 changes: 30 additions & 0 deletions .husky/_/husky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
if [ -z "$husky_skip_init" ]; then
debug () {
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1"
}

readonly hook_name="$(basename "$0")"
debug "starting $hook_name..."

if [ "$HUSKY" = "0" ]; then
debug "HUSKY env variable is set to 0, skipping hook"
exit 0
fi

if [ -f ~/.huskyrc ]; then
debug "sourcing ~/.huskyrc"
. ~/.huskyrc
fi

export readonly husky_skip_init=1
sh -e "$0" "$@"
exitCode="$?"

if [ $exitCode != 0 ]; then
echo "husky - $hook_name hook exited with code $exitCode (error)"
exit $exitCode
fi

exit 0
fi
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
12 changes: 12 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"printWidth": 120,
"tabWidth": 2,
"tabs": true,
"semi": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "es5",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"arrowParens": "always"
}
44 changes: 44 additions & 0 deletions commitlint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Definition Description
- feat A new feature
- fix A bug fix
- docs Documentation only changes
- style Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- refactor A code change that neither fixes a bug nor adds a feature
- perf A code change that improves performance
- test Adding missing or correcting existing tests
- chore Changes to the build process or auxiliary tools and libraries such as documentation generation
* X.Y.Z => Release versioning format
- fix(pencil): loader element not loading fix => Will bump up Z
- feat(pencil): new datepicker component added => Will bump up Y
- perf(pencil): vue3 released => Will bump the X
- BREAKING CHANGE: vue3 released => Will bump the Y
- Refer for the format of commit messages: https://github.com/conventional-changelog/commitlint/#what-is-commitlint
*/

module.exports = {

extends: ['@commitlint/config-conventional'],
ignores: [(message) => message.includes('WIP')],
rules: {
'body-max-line-length': [0, 'always', Infinity], // added this due to semantic release bug
},

};
Loading

0 comments on commit b04368e

Please sign in to comment.