Release v0.0.2 #3
3
.commitlintrc
Normal file
3
.commitlintrc
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"extends": ["@commitlint/config-conventional"]
|
||||||
|
}
|
||||||
10
.editorconfig
Normal file
10
.editorconfig
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{js,json,yml}]
|
||||||
|
charset = utf-8
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
20
.github/workflows/publishing.yml
vendored
Normal file
20
.github/workflows/publishing.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
name: Publish Package
|
||||||
|
run-name: Publishing Package to npmjs registry
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
jobs:
|
||||||
|
publishing:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Use Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version-file: '.nvmrc'
|
||||||
|
cache: 'yarn'
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
- run: yarn
|
||||||
|
- run: yarn npm publish
|
||||||
1
.husky/commit-msg
Normal file
1
.husky/commit-msg
Normal file
@ -0,0 +1 @@
|
|||||||
|
npx --no -- commitlint --edit $1
|
||||||
8
.versionrc
Normal file
8
.versionrc
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"header": "# ksv741 Eslint Config",
|
||||||
|
"releaseCommitMessageFormat": "build: v{{currentTag}}",
|
||||||
|
"types": [
|
||||||
|
{"type": "feat", "section": "🚀 New Features"},
|
||||||
|
{"type": "fix", "section": "\uD83D\uDEE0\uFE0F Bug Fixes"}
|
||||||
|
]
|
||||||
|
}
|
||||||
BIN
.yarn/install-state.gz
Normal file
BIN
.yarn/install-state.gz
Normal file
Binary file not shown.
893
.yarn/releases/yarn-4.1.1.cjs
vendored
Executable file
893
.yarn/releases/yarn-4.1.1.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
7
.yarnrc.yml
Normal file
7
.yarnrc.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
npmAuthToken: "${NODE_AUTH_TOKEN-fallback}"
|
||||||
|
|
||||||
|
npmPublishRegistry: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-4.1.1.cjs
|
||||||
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# ksv741 Eslint Config
|
||||||
|
### 0.0.2 (2024-04-08)
|
||||||
|
|
||||||
|
|
||||||
|
### 🚀 New Features
|
||||||
|
|
||||||
|
* add github actions ([a50fd66](https://github.com/ksv741/eslint-config-ksv741/commit/a50fd664e17ccfaaa9d853f1c09b63a217570bac))
|
||||||
|
* add jest ruleset ([ca0bbac](https://github.com/ksv741/eslint-config-ksv741/commit/ca0bbac5c0b4a79a1c47411cc986130e9c914566))
|
||||||
|
* upgrade yarn, add linting packages ([a8e08f8](https://github.com/ksv741/eslint-config-ksv741/commit/a8e08f88794c17ec5ab3001538dabf49f9d93863))
|
||||||
84
README.md
84
README.md
@ -1,27 +1,56 @@
|
|||||||
### Конфиг eslint, который поможет в написании как JavaScript приложений, так и приложений использующих Typescript и React
|
## eslint-config-ksv741
|
||||||
|
***
|
||||||
|
### Конфиг eslint для JavaScript, TypeScript, React, Jest
|
||||||
|
***
|
||||||
|
### Содержание
|
||||||
|
- [`Установка`](#установка)
|
||||||
|
- [`Использование`](#использование)
|
||||||
|
- [`Настройка`](#настройка)
|
||||||
|
- [`Кастомизация`](#кастомизация)
|
||||||
|
- [`Плагины`](#плагины)
|
||||||
|
***
|
||||||
|
|
||||||
### Список используемых плагинов:
|
### Установка
|
||||||
* [`@stylistic/eslint-plugin`](https://eslint.style/rules) - [Rules](https://eslint.style/rules)
|
|
||||||
* [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import) [Rules](https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules)
|
|
||||||
* [`@typescript-eslint/eslint-plugin`](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) [Rules](https://typescript-eslint.io/rules/)
|
|
||||||
* [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) [Rules](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/main/docs/rules)
|
|
||||||
* [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) [Rules](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules)
|
|
||||||
* [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) [Rules](https://legacy.reactjs.org/docs/hooks-rules.html#eslint-plugin)
|
|
||||||
|
|
||||||
### Настройка
|
#### npm
|
||||||
|
|
||||||
Для подключения добавьте конфиг в файл конфигурации Eslint
|
```js
|
||||||
|
npm install --save-dev eslint-config-ksv741
|
||||||
|
```
|
||||||
|
|
||||||
|
#### yarn
|
||||||
|
|
||||||
|
```js
|
||||||
|
yarn add --dev eslint-config-ksv741
|
||||||
|
```
|
||||||
|
|
||||||
|
#### pnpm
|
||||||
|
|
||||||
|
```js
|
||||||
|
pnpm add --save-dev eslint-config-ksv741
|
||||||
|
```
|
||||||
|
|
||||||
|
### Использование
|
||||||
|
|
||||||
|
Для подключения - добавьте конфиг в файл конфигурации `Eslint`
|
||||||
|
|
||||||
```js
|
```js
|
||||||
extends: ["ksv741"]
|
extends: ["ksv741"]
|
||||||
```
|
```
|
||||||
|
|
||||||
либо можете точечно переопределить для каких файлов использовать конкретную часть конфигурации
|
Доступны следующие конфиги:
|
||||||
|
|
||||||
* `ksv741/js-base` - содержит правила для файлов `JavaScript`
|
* `ksv741/js-base` - содержит правила для файлов `JavaScript`
|
||||||
* `ksv741/js-react` - содержит правила для файлов `JavaScript` и правила для `JSX` и `React`
|
* `ksv741/js-react` - содержит правила для файлов `JavaScript` и правила для `JSX` и `React`
|
||||||
* `ksv741/ts-base` - содержит правила для файлов `JavaScript` и правила для файлов `TypeScript`
|
* `ksv741/ts-base` - содержит правила для файлов `JavaScript` и правила для файлов `TypeScript`
|
||||||
* `ksv741/ts-react` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX` и `React`
|
* `ksv741/ts-react` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX` и `React`
|
||||||
|
* `ksv741/jest` - содержит правила для `Jest`
|
||||||
|
* `ksv741` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX`, `React`, `Jest` - Рекомендуется использовать
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Настройка
|
||||||
|
|
||||||
|
Можно точечно переопределить для каких файлов использовать определенный конфиг
|
||||||
|
|
||||||
```js
|
```js
|
||||||
overrides: [
|
overrides: [
|
||||||
@ -40,10 +69,19 @@ overrides: [
|
|||||||
{
|
{
|
||||||
files: ["*.tsx"],
|
files: ["*.tsx"],
|
||||||
extends: ["ksv741/ts-react"]
|
extends: ["ksv741/ts-react"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
"**/__tests__/**/*.[jt]s?(x)",
|
||||||
|
"**/?(*.)+(spec|test).[jt]s?(x)"
|
||||||
|
],
|
||||||
|
extends: ["ksv741/jest"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Кастомизация
|
||||||
|
|
||||||
Для файлов, использующих конфигурацию `ksv741/ts-base` или `ksv741/ts-react` по умолчанию используется [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser) и [`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript).
|
Для файлов, использующих конфигурацию `ksv741/ts-base` или `ksv741/ts-react` по умолчанию используется [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser) и [`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript).
|
||||||
Но вы можете это переопределить, используя настройки плагина [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#importparsers)
|
Но вы можете это переопределить, используя настройки плагина [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import?tab=readme-ov-file#importparsers)
|
||||||
Например, добавим настройку для использования [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) и [eslint-import-resolver-webpack](https://www.npmjs.com/package/eslint-import-resolver-webpack)
|
Например, добавим настройку для использования [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) и [eslint-import-resolver-webpack](https://www.npmjs.com/package/eslint-import-resolver-webpack)
|
||||||
@ -66,3 +104,25 @@ overrides: [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**ВНИМАНИЕ**
|
||||||
|
Для проектов использующих `TypeScript` предустановлены [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser) и [`eslint-import-resolver-typescript`](https://www.npmjs.com/package/eslint-import-resolver-typescript).
|
||||||
|
Алиасы путей обычно хранятся в настройке `paths` файла `tsconfig.json`
|
||||||
|
|
||||||
|
|
||||||
|
По умолчанию, для файлов `.js`, `.jsx` **не** предустановлен парсер и плагин для разрешения путей,
|
||||||
|
т.к. в зависимости от проекта инструменты могут значительно отличаться,
|
||||||
|
предполагается что эта настройка будет установлена самостоятельно.
|
||||||
|
|
||||||
|
|
||||||
|
### Плагины:
|
||||||
|
* [`@stylistic/eslint-plugin`](https://eslint.style/rules) - [Rules](https://eslint.style/rules)
|
||||||
|
* [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import) [Rules](https://github.com/import-js/eslint-plugin-import/tree/main/docs/rules)
|
||||||
|
* [`@typescript-eslint/eslint-plugin`](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) [Rules](https://typescript-eslint.io/rules/)
|
||||||
|
* [`eslint-plugin-jsx-a11y`](https://www.npmjs.com/package/eslint-plugin-jsx-a11y) [Rules](https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/tree/main/docs/rules)
|
||||||
|
* [`eslint-plugin-react`](https://www.npmjs.com/package/eslint-plugin-react) [Rules](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules)
|
||||||
|
* [`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks) [Rules](https://legacy.reactjs.org/docs/hooks-rules.html#eslint-plugin)
|
||||||
|
* [`eslint-plugin-jest`](https://www.npmjs.com/package/eslint-plugin-jest) [Rules](https://github.com/jest-community/eslint-plugin-jest/tree/main/docs/rules)
|
||||||
|
* [`eslint-plugin-jest-dom`](https://www.npmjs.com/package/eslint-plugin-jest-dom) [Rules](https://github.com/testing-library/eslint-plugin-jest-dom/tree/main/docs/rules)
|
||||||
|
* [`eslint-plugin-jest-formatting`](https://www.npmjs.com/package/eslint-plugin-jest-formatting) [Rules](https://github.com/dangreenisrael/eslint-plugin-jest-formatting/tree/master/docs/rules)
|
||||||
|
* [`eslint-plugin-testing-library`](https://www.npmjs.com/package/eslint-plugin-testing-library) [Rules](https://github.com/testing-library/eslint-plugin-testing-library)
|
||||||
|
|||||||
7
index.js
7
index.js
@ -16,5 +16,12 @@ module.exports = {
|
|||||||
files: ['**/*.tsx'],
|
files: ['**/*.tsx'],
|
||||||
extends: [require.resolve('./ts-react')],
|
extends: [require.resolve('./ts-react')],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
'**/__tests__/**/*.[jt]s?(x)',
|
||||||
|
'**/?(*.)+(spec|test).[jt]s?(x)'
|
||||||
|
],
|
||||||
|
extends: [require.resolve('./js-ts-jest')],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
8
js-ts-jest.js
Normal file
8
js-ts-jest.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
extends: [
|
||||||
|
'./rules/jest/.eslint-jest',
|
||||||
|
'./rules/jest/.eslint-jest-dom',
|
||||||
|
'./rules/jest/.eslint-jest-formatting',
|
||||||
|
'./rules/jest/.eslint-jest-testing-library',
|
||||||
|
].map(require.resolve)
|
||||||
|
};
|
||||||
24
package.json
24
package.json
@ -22,9 +22,13 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/ksv741/eslint-config-ksv741"
|
"url": "https://github.com/ksv741/eslint-config-ksv741"
|
||||||
},
|
},
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "8.56.0"
|
"@commitlint/cli": "19.2.1",
|
||||||
|
"@commitlint/config-conventional": "19.1.0",
|
||||||
|
"eslint": "8.56.0",
|
||||||
|
"husky": "9.0.11",
|
||||||
|
"standard-version": "9.5.0"
|
||||||
},
|
},
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -36,12 +40,16 @@
|
|||||||
"@typescript-eslint/parser": "6.20.0",
|
"@typescript-eslint/parser": "6.20.0",
|
||||||
"eslint-import-resolver-typescript": "3.6.1",
|
"eslint-import-resolver-typescript": "3.6.1",
|
||||||
"eslint-plugin-import": "2.29.1",
|
"eslint-plugin-import": "2.29.1",
|
||||||
|
"eslint-plugin-jest": "27.9.0",
|
||||||
|
"eslint-plugin-jest-dom": "5.2.0",
|
||||||
|
"eslint-plugin-jest-formatting": "3.1.0",
|
||||||
"eslint-plugin-jsx-a11y": "6.8.0",
|
"eslint-plugin-jsx-a11y": "6.8.0",
|
||||||
"eslint-plugin-react": "7.33.2",
|
"eslint-plugin-react": "7.33.2",
|
||||||
"eslint-plugin-react-hooks": "4.6.0"
|
"eslint-plugin-react-hooks": "4.6.0",
|
||||||
|
"eslint-plugin-testing-library": "6.2.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"eslint": "^8.56.0",
|
"eslint": ">=8.56.0",
|
||||||
"typescript": ">=4.2.2"
|
"typescript": ">=4.2.2"
|
||||||
},
|
},
|
||||||
"peerDependenciesMeta": {
|
"peerDependenciesMeta": {
|
||||||
@ -54,6 +62,12 @@
|
|||||||
"./js-base": "./js-base.js",
|
"./js-base": "./js-base.js",
|
||||||
"./js-react": "./js-react.js",
|
"./js-react": "./js-react.js",
|
||||||
"./ts-react": "./ts-react.js",
|
"./ts-react": "./ts-react.js",
|
||||||
"./ts-base": "./ts-base.js"
|
"./ts-base": "./ts-base.js",
|
||||||
|
"./jest": "./js-ts-jest.js"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"release": "standard-version",
|
||||||
|
"release:rc": "standard-version --prerelease rc",
|
||||||
|
"prepare": "husky"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ module.exports = {
|
|||||||
'mjs': 'never',
|
'mjs': 'never',
|
||||||
'cjs': 'never',
|
'cjs': 'never',
|
||||||
'js': 'never',
|
'js': 'never',
|
||||||
|
'jsx': 'never',
|
||||||
}],
|
}],
|
||||||
'import/first': 'error',
|
'import/first': 'error',
|
||||||
'import/group-exports': 'off',
|
'import/group-exports': 'off',
|
||||||
@ -107,10 +108,10 @@ module.exports = {
|
|||||||
settings: {
|
settings: {
|
||||||
'import/resolver': {
|
'import/resolver': {
|
||||||
node: {
|
node: {
|
||||||
extensions: ['.mjs', '.cjs', '.js', '.json'],
|
extensions: ['.mjs', '.cjs', '.js', '.jsx', '.json'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'import/extensions': ['.mjs', '.cjs', '.js', '.json'],
|
'import/extensions': ['.mjs', '.cjs', '.jsx', '.json'],
|
||||||
'import/core-modules': [],
|
'import/core-modules': [],
|
||||||
'import/ignore': [
|
'import/ignore': [
|
||||||
'node_modules',
|
'node_modules',
|
||||||
|
|||||||
11
rules/jest/.eslint-jest-dom.js
Normal file
11
rules/jest/.eslint-jest-dom.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
jest: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
'jest-dom',
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'plugin:jest-dom/recommended',
|
||||||
|
],
|
||||||
|
}
|
||||||
8
rules/jest/.eslint-jest-formatting.js
Normal file
8
rules/jest/.eslint-jest-formatting.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
'jest-formatting',
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'plugin:jest-formatting/recommended',
|
||||||
|
],
|
||||||
|
}
|
||||||
8
rules/jest/.eslint-jest-testing-library.js
Normal file
8
rules/jest/.eslint-jest-testing-library.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
'testing-library',
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'plugin:testing-library/react',
|
||||||
|
],
|
||||||
|
}
|
||||||
8
rules/jest/.eslint-jest.js
Normal file
8
rules/jest/.eslint-jest.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: [
|
||||||
|
'jest',
|
||||||
|
],
|
||||||
|
extends: [
|
||||||
|
'plugin:jest/recommended'
|
||||||
|
],
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user