Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true


[*.gradle]
indent_size = 4
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
commitlint.config.js
jest.config.js
lib
release.config.js
9 changes: 9 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./src/index.js",
"rules": {
"prefer-destructuring": "off"
},
"parserOptions": {
"createDefaultProgram": true
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
21 changes: 21 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Code style'

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- run: yarn lint
17 changes: 17 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "PR"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
name: Ensure semantic PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release
on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- run: yarn test
- run: yarn semantic-release
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SEMANTIC_RELEASE_SLACK_WEBHOOK }}
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Test'

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
test:
name: Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'yarn'
node-version-file: '.nvmrc'
- run: yarn install --frozen-lockfile
- run: yarn test
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# OSX
#
.DS_Store
.npmrc

# node.js
#
node_modules/
.eslintcache
npm-debug.log
yarn-error.log
lib
coverage
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
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 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"

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

yarn commitlint --edit || exec < /dev/tty && yarn cz --hook > /dev/null 2>&1 || true
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.{js,jsx,ts,tsx}": "eslint --cache --format=node_modules/eslint-formatter-pretty --ext .ts,.tsx"
}
15 changes: 15 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.github
.husky
.vscode
node_modules
test
.editorconfig
.eslintrc.json
.gitattributes
.gitignore
.nvmrc
commitlint.config.js
release.config.js
renovate.json
tsconfig.json
yarn.lock
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/gallium
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
1 change: 1 addition & 0 deletions .watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
![npm](https://img.shields.io/npm/v/@txo/eslint-config-txo-typescript-react)
![codecov](https://img.shields.io/codecov/c/github/technology-studio/eslint-config-txo-typescript-react)
# Eslint typescript react config #

Eslint typescript react config
3 changes: 3 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- No rule found for
// export type GenericDangleError = Generic< number >
export type GenericDangleOk = Generic<number>
19 changes: 19 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @Author: Rostislav Simonik <rostislav.simonik@technologystudio.sk>
* @Date: 2022-08-21T12:08:59+02:00
* @Copyright: Technology Studio
**/

const automaticCommitPattern = /^chore\(release\):.*\[skip ci]/

const commitlintConfig = {
extends: [
'@commitlint/config-conventional',
],

ignores: [
commitMsg => automaticCommitPattern.test(commitMsg),
],
}

module.exports = commitlintConfig
69 changes: 69 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"name": "eslint-config-txo-typescript-react",
"version": "1.0.0",
"description": "Technology Studio - Eslint typescript react config",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/technology-studio/eslint-config-txo-typescript-react.git"
},
"author": {
"name": "Technology Studio",
"email": "npm@technologystudio.sk",
"url": "https://github.com/technology-studio/"
},
"license": "MIT",
"private": false,
"scripts": {
"lint": "eslint --format=node_modules/eslint-formatter-pretty --ext .jsx,.js,.ts,.tsx .",
"fixcode": "eslint --format=node_modules/eslint-formatter-pretty --ext .jsx,.js,.ts,.tsx . --fix",
"git-hook": "yarn -s lint-staged",
"test": "yarn lint",
"prepare": "husky install",
"sanity": "yarn lint && tsc --noEmit && yarn outdated && echo 'success'",
"semantic-release": "semantic-release"
},
"dependencies": {
"eslint-config-txo-typescript": "^3.1.24"
},
"peerDependencies": {
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-redux-saga": "^1.3.2"
},
"devDependencies": {
"@commitlint/cli": "^17.1.2",
"@commitlint/config-conventional": "^17.1.0",
"@semantic-release/changelog": "^6.0.1",
"@semantic-release/git": "^10.0.1",
"@types/react": "^18.0.21",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"@typescript-eslint/parser": "^5.38.1",
"commitizen": "^4.2.5",
"eslint": "^8.24.0",
"eslint-formatter-pretty": "^4.1.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.0.4",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-n": "^15.3.0",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-redux-saga": "^1.3.2",
"husky": "^8.0.1",
"jest": "^29.1.1",
"lint-staged": "^13.0.3",
"react": "^18.2.0",
"redux-saga": "^1.2.1",
"semantic-release": "^19.0.5",
"semantic-release-slack-bot": "^3.5.3",
"typescript": "^4.8.4"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
53 changes: 53 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @Author: Rostislav Simonik <rostislav.simonik@technologystudio.sk>
* @Date: 2022-08-21T13:08:66+02:00
* @Copyright: Technology Studio
**/

module.exports = {
branches: [
'main',
],
plugins: [
['@semantic-release/commit-analyzer', {
present: 'conventionalcommits',
releaseRules: [
{ breaking: true, release: 'major' },
{ revert: true, release: 'patch' },
{ type: 'docs', release: 'patch' },
{ type: 'feat', release: 'minor' },
{ type: 'fix', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ scope: 'no-release', release: false },
],
}],
['@semantic-release/release-notes-generator', {
preset: 'conventionalcommits',
presetConfig: {
types: [
{ type: 'build', section: 'Build system / dependencies' },
{ type: 'ci', section: 'CI' },
{ type: 'docs', section: 'Documentation' },
{ type: 'feat', section: 'Features' },
{ type: 'fix', section: 'Bug fixes' },
{ type: 'perf', section: 'Performance' },
{ type: 'refactor', section: 'Refactoring' },
{ type: 'test', section: 'Testing' },
],
},
}],
['semantic-release-slack-bot',
{
notifyOnSuccess: true,
notifyOnFail: true,
},
],
'@semantic-release/changelog',
'@semantic-release/npm',
'@semantic-release/github',
['@semantic-release/git', {
assets: ['CHANGELOG.md', 'package.json'],
}],
],
}
25 changes: 25 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommits",
":automergeMinor"
],
"rangeStrategy": "bump",
"packageRules": [
{
"matchDepTypes": [
"peerDependencies"
],
"semanticCommitType": "fix"
}
],
"assignees": [
"rostislav-simonik",
"erik-slovak"
],
"reviewers": [
"rostislav-simonik",
"erik-slovak"
]
}
23 changes: 23 additions & 0 deletions src/configs/jsx-a11y.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @Author: Erik Slovak <erik.slovak@technologystudio.sk>
* @Date: 2022-08-10T14:08:90+02:00
* @Copyright: Technology Studio
**/

module.exports = {
rules: {
'jsx-a11y/aria-props': 'error',
'jsx-a11y/label-has-associated-control': [
'error',
{
// NOTE: If this error triggers, either disable it or add
// your custom components, labels and attributes via these options
// See https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/label-has-associated-control.md
controlComponents: ['Input'],
},
],
'jsx-a11y/mouse-events-have-key-events': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
'jsx-a11y/role-supports-aria-props': 'error',
},
}
Loading