Skip to content

Commit

Permalink
feat(eslint-plugin-tinkoff): split eslint-plugin-tinkoff (#45)
Browse files Browse the repository at this point in the history
* feat(eslint-plugin-tinkoff): add eslint-plugin-tinkoff source code to packages

* feat(eslint-plugin-tinkoff): move eslint-plugin-tinkoff from packages, review fixes

* feat(eslint-plugin-tinkoff): split eslint-plugin-tinkoff

* feat(eslint-plugin-tinkoff): update configurations .prettierrc

* feat(eslint-plugin-tinkoff): add readme files and prelint npm scripts

* feat(eslint-plugin-tinkoff): run eslint local inside packages

Co-authored-by: o.drapeza <o.drapeza@tinkoff.ru>
  • Loading branch information
SuperOleg39 and o.drapeza authored Jun 15, 2020
1 parent 2fe98e9 commit 50d14b1
Show file tree
Hide file tree
Showing 52 changed files with 12,509 additions and 6,264 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

6 changes: 0 additions & 6 deletions .eslintrc.js

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts-prepend-node-path=true
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: node_js
cache:
npm: false
node_js:
- "12"
- "11"
- "10"
- "9"
- "8"
- "node"

install:
Expand Down
16,465 changes: 10,233 additions & 6,232 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 18 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
"scripts": {
"********** Linters": "",
"prettier": "prettier --write --loglevel=warn '**/*.{md,json,template.html}'",
"prettier:ci": "prettier --check '**/*.{md,json,template.html}'",
"eslint": "eslint --fix 'packages/**/*.{ts,js}'",
"eslint:ci": "eslint 'packages/**/*.{ts,js}'",
"lint": "concurrently 'npm:prettier' 'npm:eslint' 'npm:lint:all'",
"prettier:ci": "prettier --write '**/*.{md,json,template.html}'",
"lint": "concurrently 'npm:prettier' 'npm:lint:all'",
"lint:all": "lerna run lint:ci --parallel",
"lint:ci": "concurrently 'npm:prettier:ci' 'npm:eslint:ci' 'npm:lint:all'",
"lint:ci": "concurrently 'npm:prettier:ci' 'npm:lint:all'",
"*** Bootstrap": "",
"preinstall": "echo 'Use `npm run bootstrap` instead!'; exit 1",
"prebootstrap": "rm -rf packages/*/node_modules",
Expand All @@ -35,13 +33,27 @@
"url": "https://github.com/TinkoffCreditSystems/linters.git"
},
"devDependencies": {
"@types/eslint": "^6.8.0",
"@types/jest": "^25.2.3",
"@types/node": "^14.0.1",
"@tinkoff/eslint-plugin": "file:./packages/eslint-plugin",
"concurrently": "5.0.1",
"conventional-changelog-conventionalcommits": "^4.2.3",
"husky": "^4.2.0",
"lerna": "^3.20.2",
"lint-staged": "^10.0.1",
"markdown-toc": "^1.2.0",
"prettier": "^1.19.1"
"prettier": "^1.19.1",
"jest": "^26.0.1",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"ts-jest": "^26.0.0",
"typescript": "^3.9.2",

"@typescript-eslint/eslint-plugin": "^3.0.0-alpha.27",
"@typescript-eslint/parser": "^3.0.0-alpha.27",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-import": "^2.20.2"
}
}
15 changes: 15 additions & 0 deletions packages/eslint-config-angular/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*/__fixtures__/*
*/__snapshots__/*

# from .gitignore
node_modules/

# IDE
.DS_Store
.vscode
.idea

# Compiled sources
lib

.tmp
7 changes: 7 additions & 0 deletions packages/eslint-config-angular/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"root": true,

"extends": [
"@tinkoff/eslint-config/lib"
]
}
21 changes: 21 additions & 0 deletions packages/eslint-config-angular/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Dependency directories
node_modules/

# IDE
.DS_Store
.vscode
.idea

# Compiled sources
lib

.tmp

debug-path
8 changes: 8 additions & 0 deletions packages/eslint-config-angular/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"trailingComma": "es5",
"proseWrap": "never",
"arrowParens": "always",
"tabWidth": 2,
"printWidth": 100
}
19 changes: 19 additions & 0 deletions packages/eslint-config-angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# eslint-config-tinkoff

ESlint plugin includes Tinkoff rules for Angular applications.

## Usage

Install from npm

```bash
npm i --save-dev @tinkoff/eslint-config @tinkoff/eslint-config-angular
```

Then, need to include necessary configurations sets to `.eslintrc`. Wee need to choose base configuration, and any necessary additional configs.

```bash
{
"extends": ["@tinkoff/eslint-config/app", "@tinkoff/eslint-config-angular"]
}
```
6 changes: 6 additions & 0 deletions packages/eslint-config-angular/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
cacheDirectory: '<rootDir>/.tmp/jest',
timers: 'fake',
};
49 changes: 49 additions & 0 deletions packages/eslint-config-angular/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"name": "@tinkoff/eslint-config-angular",
"version": "0.1.0",
"description": "Tinkoff ESLint configs for Angular apps",
"license": "Apache-2.0",
"keywords": [
"eslint",
"eslintconfig",
"eslint-config"
],
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest --clearCache && jest",
"test:watch": "npm run test -- --watch",
"lint": "eslint --ext .jsx,.js,.ts,.tsx --ignore-path .eslintignore .",
"lint:fix": "npm run lint -- --fix",
"prelint:ci": "npm run build",
"pretest:ci": "npm run build",
"preversion": "npm run build",
"build:prod": "npm run build",
"build:watch": "npm run watch",
"test:ci": "",
"lint:ci": "npm run lint"
},
"main": "lib/index.js",
"files": [
"lib",
"src"
],
"author": {
"name": "Tinkoff Team",
"email": "frontend@tinkoff.ru"
},
"repository": {
"type": "git",
"url": "https://github.com/TinkoffCreditSystems/linters.git"
},
"dependencies": {},
"devDependencies": {
"@tinkoff/eslint-config": "^0.1.0"
},
"peerDependencies": {
"@typescript-eslint/eslint-plugin": ">=3",
"eslint": ">=7",
"eslint-plugin-import": ">=2.20",
"eslint-plugin-sort-class-members": ">=1.7"
}
}
13 changes: 13 additions & 0 deletions packages/eslint-config-angular/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
extends: [],

plugins: [],

rules: {
'import/no-webpack-loader-syntax': 'off',
'sort-class-members/sort-class-members': 'off',
'no-param-reassign': 'off',
'@typescript-eslint/no-useless-constructor': 'off',
'@typescript-eslint/no-extraneous-class': 'off', // incorrect working with constructor parameters
},
};
31 changes: 31 additions & 0 deletions packages/eslint-config-angular/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"compilerOptions": {
"declarationDir": "./lib",
"outDir": "./lib",
"moduleResolution": "node",
"target": "es2017",
"module": "commonjs",
"lib": ["es2015", "es2016", "es2017", "es2018", "dom"],
"strict": false,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"experimentalDecorators": true,
"jsx": "react",
"esModuleInterop": true,
"noUnusedLocals": false,
"resolveJsonModule": true,
"noUnusedParameters": false,
"skipLibCheck": true,
"noEmitOnError": true
},
"include": ["./src"],
"exclude": [
"**/*.spec.ts",
"**/*.spec.tsx",
"**/*.test.ts",
"**/*.test.tsx",
"**/*.bench.ts",
"**/__tests__/**"
]
}
15 changes: 15 additions & 0 deletions packages/eslint-config-react/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
*/__fixtures__/*
*/__snapshots__/*

# from .gitignore
node_modules/

# IDE
.DS_Store
.vscode
.idea

# Compiled sources
lib

.tmp
7 changes: 7 additions & 0 deletions packages/eslint-config-react/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"root": true,

"extends": [
"@tinkoff/eslint-config/lib"
]
}
21 changes: 21 additions & 0 deletions packages/eslint-config-react/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Dependency directories
node_modules/

# IDE
.DS_Store
.vscode
.idea

# Compiled sources
lib

.tmp

debug-path
8 changes: 8 additions & 0 deletions packages/eslint-config-react/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"singleQuote": true,
"trailingComma": "es5",
"proseWrap": "never",
"arrowParens": "always",
"tabWidth": 2,
"printWidth": 100
}
24 changes: 24 additions & 0 deletions packages/eslint-config-react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# eslint-config-tinkoff

ESlint plugin includes Tinkoff rules for React applications.

## Usage

Install from npm

```bash
npm i --save-dev @tinkoff/eslint-config @tinkoff/eslint-config-react
```

Then, need to include necessary configurations sets to `.eslintrc`. Wee need to choose base configuration, and any necessary additional configs.

```bash
{
"extends": ["@tinkoff/eslint-config/app", "@tinkoff/eslint-config-react"]
}
```

## Internal used plugins

- `eslint-plugin-react` - common react lint rules
- `eslint-plugin-react-hooks` - lint rules for react hooks
6 changes: 6 additions & 0 deletions packages/eslint-config-react/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
cacheDirectory: '<rootDir>/.tmp/jest',
timers: 'fake',
};
53 changes: 53 additions & 0 deletions packages/eslint-config-react/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"name": "@tinkoff/eslint-config-react",
"version": "0.1.0",
"description": "Tinkoff ESLint configs for React apps",
"license": "Apache-2.0",
"keywords": [
"eslint",
"eslintconfig",
"eslint-config"
],
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"test": "jest --clearCache && jest",
"test:watch": "npm run test -- --watch",
"lint": "eslint --ext .jsx,.js,.ts,.tsx --ignore-path .eslintignore .",
"lint:fix": "npm run lint -- --fix",
"prelint:ci": "npm run build",
"pretest:ci": "npm run build",
"preversion": "npm run build",
"build:prod": "npm run build",
"build:watch": "npm run watch",
"test:ci": "",
"lint:ci": "npm run lint"
},
"main": "lib/index.js",
"files": [
"lib",
"src"
],
"author": {
"name": "Tinkoff Team",
"email": "frontend@tinkoff.ru"
},
"repository": {
"type": "git",
"url": "https://github.com/TinkoffCreditSystems/linters.git"
},
"dependencies": {
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.20.0",
"eslint-plugin-react-hooks": "^4.0.1"
},
"devDependencies": {
"@tinkoff/eslint-config": "^0.1.0"
},
"peerDependencies": {
"eslint": ">=7",
"eslint-config-prettier": ">=6.11",
"eslint-plugin-import": ">=2.20"
}
}
Loading

0 comments on commit 50d14b1

Please sign in to comment.