Skip to content

Commit

Permalink
chore: typescript + lint setup
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunvegda committed Feb 6, 2022
1 parent b1b9629 commit ca634ee
Show file tree
Hide file tree
Showing 16 changed files with 7,180 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .commitlintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": [
"@commitlint/config-conventional"
]
}
3 changes: 3 additions & 0 deletions .czrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "cz-conventional-changelog"
}
47 changes: 47 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
ecmaVersion: 10,
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"airbnb-base",
"airbnb-typescript/base",
"prettier"
],
plugins: [
'@typescript-eslint',
'eslint-plugin-tsdoc',
'jest'
],
env: {
es2021: true,
browser: true,
node: true,
},
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-use-before-define': 'off',
'import/prefer-default-export': 'off',
'no-console': ["error", { allow: ["warn", "info", "error"] }],
'no-underscore-dangle': 'off',
'no-shadow': 'off',
'no-plusplus': 'off',
'tsdoc/syntax': 'warn',
'arrow-body-style': 'off',
'@typescript-eslint/naming-convention': [
'error',
{
selector: ['variable', 'function'],
format: ['camelCase', 'UPPER_CASE', 'PascalCase'],
trailingUnderscore: 'allow',
},
],
},
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ dist

# yarn v2
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
Expand Down
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"

yarn commit-lint --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"

yarn run lint-staged
58 changes: 58 additions & 0 deletions .idea/codeStyles/Project.xml

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

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

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

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

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

7 changes: 7 additions & 0 deletions .idea/prettier.xml

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

9 changes: 9 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"**/*.{ts,tsx,js,jsx}": [
"eslint --quiet --fix",
"prettier --write"
],
"**/*.{md,yml,json,babelrc,eslintrc,prettierrc}": [
"prettier --write"
]
}
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"bracketSpacing": true,
"printWidth": 100,
"proseWrap": "always",
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}
42 changes: 38 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"name": "japanese-moji",
"version": "1.0.0",
"description": "A toolkit to validate Japanese characters",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"type": "module",
"packageManager": "yarn@3.1.1",
"repository": {
"type": "git",
Expand Down Expand Up @@ -33,5 +31,41 @@
"bugs": {
"url": "https://github.com/arjunvegda/japanese-moji/issues"
},
"homepage": "https://github.com/arjunvegda/japanese-moji#readme"
"homepage": "https://github.com/arjunvegda/japanese-moji#readme",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
"lint-staged": "lint-staged",
"commit-lint": "commitlint"
},
"engines": {
"node": "^14.13.1 || >=16.0.0",
"yarn": ">=3"
},
"devDependencies": {
"@commitlint/cli": "^16.1.0",
"@commitlint/config-conventional": "^16.0.0",
"@types/jest": "^27.4.0",
"@types/node": "^17.0.15",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^5.10.2",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.8.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^16.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-tsdoc": "^0.2.14",
"husky": "^7.0.4",
"jest": "^27.5.0",
"lint-staged": "^12.3.3",
"prettier": "^2.5.1",
"ts-node": "^10.4.0",
"tslib": "^2.3.1",
"typescript": "^4.5.5"
}
}
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const sayHello = () => {
console.info(`Hello`);
};
30 changes: 30 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"compilerOptions": {
"incremental": true,
"target": "ES2020",
"module": "ESNext",
"lib": ["es2017", "es2020"],
"strict": true,
"importsNotUsedAsValues": "error",
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"esModuleInterop": true,
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"declaration": true,
"declarationDir": "build",
"sourceMap": true,
"importHelpers": true,
"resolveJsonModule": true,
"baseUrl": "./src",
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"typeRoots": ["node_modules/@types/", "@types"],
"rootDir": "./src",
"outDir": "build",
"noEmit": true
},
"include": ["./src/**/*", "__tests__/**/*"],
"exclude": ["node_modules"]
}
Loading

0 comments on commit ca634ee

Please sign in to comment.