Release v0.1.0 #8
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/offline-cache/debug-npm-4.3.7-385645adf9-1471db19c3.zip
Normal file
BIN
.yarn/offline-cache/debug-npm-4.3.7-385645adf9-1471db19c3.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/offline-cache/globals-npm-14.0.0-5fc3d8d5da-b96ff42620.zip
Normal file
BIN
.yarn/offline-cache/globals-npm-14.0.0-5fc3d8d5da-b96ff42620.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/offline-cache/semver-npm-7.6.3-57e82c14d5-88f33e148b.zip
Normal file
BIN
.yarn/offline-cache/semver-npm-7.6.3-57e82c14d5-88f33e148b.zip
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/offline-cache/typescript-patch-1c74c14be0-ac8307bb06.zip
Normal file
BIN
.yarn/offline-cache/typescript-patch-1c74c14be0-ac8307bb06.zip
Normal file
Binary file not shown.
Binary file not shown.
61
README.md
61
README.md
@ -35,16 +35,22 @@ pnpm add --save-dev eslint-config-ksv741
|
||||
Для подключения - добавьте конфиг в файл конфигурации `Eslint`
|
||||
|
||||
```js
|
||||
extends: ["ksv741"]
|
||||
// eslint.config.js
|
||||
|
||||
const config = require('eslint-config-ksv741');
|
||||
|
||||
module.exports = [
|
||||
...config,
|
||||
];
|
||||
```
|
||||
|
||||
Доступны следующие конфиги:
|
||||
* `ksv741/js-base` - содержит правила для файлов `JavaScript`
|
||||
* `ksv741/js-react` - содержит правила для файлов `JavaScript` и правила для `JSX` и `React`
|
||||
* `ksv741/ts-base` - содержит правила для файлов `JavaScript` и правила для файлов `TypeScript`
|
||||
* `ksv741/ts-react` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX` и `React`
|
||||
* `ksv741/jest` - содержит правила для `Jest`
|
||||
* `ksv741` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX`, `React`, `Jest` - Рекомендуется использовать
|
||||
* `js-base` - содержит правила для файлов `JavaScript`
|
||||
* `js-react` - содержит правила для файлов `JavaScript` и правила для `JSX` и `React`
|
||||
* `ts-base` - содержит правила для файлов `JavaScript` и правила для файлов `TypeScript`
|
||||
* `ts-react` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX` и `React`
|
||||
* `jest` - содержит правила для `Jest`
|
||||
* `default` - содержит правила для файлов `JavaScript`, `TypeScript`, `JSX`, `React`, `Jest` - Рекомендуется использовать
|
||||
|
||||
|
||||
|
||||
@ -53,57 +59,46 @@ extends: ["ksv741"]
|
||||
Можно точечно переопределить для каких файлов использовать определенный конфиг
|
||||
|
||||
```js
|
||||
overrides: [
|
||||
// eslint.config.js
|
||||
|
||||
const jsBase = require('eslint-config-ksv741/js-base');
|
||||
const jsReact = require('eslint-config-ksv741/js-react');
|
||||
const tsBase = require('eslint-config-ksv741/ts-base');
|
||||
const tsReact = require('eslint-config-ksv741/ts-react');
|
||||
const jest = require('eslint-config-ksv741/jest');
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
files: ["*.js"],
|
||||
extends: ["ksv741/js-base"]
|
||||
...jsBase
|
||||
},
|
||||
{
|
||||
files: ["*.jsx"],
|
||||
extends: ["ksv741/js-react"]
|
||||
...jsReact
|
||||
},
|
||||
{
|
||||
files: ["*.ts"],
|
||||
extends: ["ksv741/ts-base"]
|
||||
...tsBase
|
||||
},
|
||||
{
|
||||
files: ["*.tsx"],
|
||||
extends: ["ksv741/ts-react"]
|
||||
...tsReact
|
||||
},
|
||||
{
|
||||
files: [
|
||||
"**/__tests__/**/*.[jt]s?(x)",
|
||||
"**/?(*.)+(spec|test).[jt]s?(x)"
|
||||
],
|
||||
extends: ["ksv741/jest"]
|
||||
...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).
|
||||
Для файлов, использующих конфигурацию `ts-base` или `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)
|
||||
Например, добавим настройку для использования [@babel/eslint-parser](https://www.npmjs.com/package/@babel/eslint-parser) и [eslint-import-resolver-webpack](https://www.npmjs.com/package/eslint-import-resolver-webpack)
|
||||
|
||||
```js
|
||||
{
|
||||
extends: ["ksv741"],
|
||||
parser: "@babel/eslint-parser",
|
||||
parserOptions: {
|
||||
babelOptions: {
|
||||
configFile: ".babelrc.js"
|
||||
}
|
||||
},
|
||||
settings: {
|
||||
"import/resolver": {
|
||||
webpack: {
|
||||
config: "webpack.config.js"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**ВНИМАНИЕ**
|
||||
Для проектов использующих `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).
|
||||
|
||||
5
configs/js-base.js
Normal file
5
configs/js-base.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = [
|
||||
require('../rules/.eslint-js'),
|
||||
require('../rules/.eslint-import'),
|
||||
require('../rules/style/.eslint-style-js'),
|
||||
];
|
||||
7
configs/js-react.js
Normal file
7
configs/js-react.js
Normal file
@ -0,0 +1,7 @@
|
||||
module.exports = [
|
||||
...require('./js-base'),
|
||||
require('../rules/react/.eslint-jsx-a11y'),
|
||||
require('../rules/react/.eslint-react'),
|
||||
require('../rules/react/.eslint-react-hooks'),
|
||||
require('../rules/style/.eslint-style-jsx'),
|
||||
];
|
||||
6
configs/js-ts-jest.js
Normal file
6
configs/js-ts-jest.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = [
|
||||
require('../rules/jest/.eslint-jest.js'),
|
||||
require('../rules/jest/.eslint-jest-dom'),
|
||||
require('../rules/jest/.eslint-jest-formatting'),
|
||||
require('../rules/jest/.eslint-jest-testing-library'),
|
||||
];
|
||||
5
configs/ts-base.js
Normal file
5
configs/ts-base.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = [
|
||||
...require('./js-base'),
|
||||
require('../rules/.eslint-ts'),
|
||||
require('../rules/style/.eslint-style-ts'),
|
||||
];
|
||||
50
configs/ts-react.js
Normal file
50
configs/ts-react.js
Normal file
@ -0,0 +1,50 @@
|
||||
const { rules: reactRules, settings: reactSettings } = require('../rules/react/.eslint-react');
|
||||
|
||||
const reactFilenameExtensionRule = reactRules['react/jsx-filename-extension'];
|
||||
|
||||
module.exports = [
|
||||
...require('./js-react'),
|
||||
...require('./ts-base'),
|
||||
{
|
||||
name: 'react-settings',
|
||||
settings: {
|
||||
'import/resolver': {
|
||||
...reactSettings['import/resolver'],
|
||||
node: {
|
||||
...reactSettings['import/resolver'].node,
|
||||
extensions: [
|
||||
...reactSettings['import/resolver'].node.extensions,
|
||||
'.ts',
|
||||
'.tsx',
|
||||
],
|
||||
},
|
||||
},
|
||||
'import/extensions': [
|
||||
...reactSettings['import/extensions'],
|
||||
'.ts',
|
||||
'.tsx',
|
||||
],
|
||||
},
|
||||
rules: {
|
||||
'@typescript-eslint/class-methods-use-this': reactRules['class-methods-use-this'],
|
||||
'import/extensions': [
|
||||
reactRules['import/extensions'][0],
|
||||
reactRules['import/extensions'][1],
|
||||
{
|
||||
...reactRules['import/extensions'][2],
|
||||
ts: 'never',
|
||||
tsx: 'never',
|
||||
},
|
||||
],
|
||||
'react/jsx-filename-extension': [reactFilenameExtensionRule[0], {
|
||||
...reactFilenameExtensionRule[1],
|
||||
extensions: [
|
||||
...reactFilenameExtensionRule[1].extensions,
|
||||
'.ts',
|
||||
'.tsx',
|
||||
],
|
||||
}],
|
||||
'react/require-default-props': 'off',
|
||||
},
|
||||
},
|
||||
];
|
||||
3
eslint.config.js
Normal file
3
eslint.config.js
Normal file
@ -0,0 +1,3 @@
|
||||
const config = require('./index');
|
||||
|
||||
module.exports = config;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user