@dmitryrechkin/eslint-standard 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/eslint.config.mjs +84 -0
- package/package.json +17 -17
- package/eslint-config.js +0 -73
package/README.md
CHANGED
|
@@ -118,6 +118,6 @@ console.log(greeting);
|
|
|
118
118
|
|
|
119
119
|
## Contributing
|
|
120
120
|
|
|
121
|
-
Contributions to improve this ESLint configuration are welcome. Please feel free to open an issue or submit a pull request on our [GitHub repository](
|
|
121
|
+
Contributions to improve this ESLint configuration are welcome. Please feel free to open an issue or submit a pull request on our [GitHub repository](https://github.com/dmitryrechkin/eslint-standard).
|
|
122
122
|
|
|
123
123
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// eslint.config.mjs
|
|
2
|
+
import tsParser from '@typescript-eslint/parser';
|
|
3
|
+
import tsPlugin from '@typescript-eslint/eslint-plugin';
|
|
4
|
+
import unusedImportsPlugin from 'eslint-plugin-unused-imports';
|
|
5
|
+
|
|
6
|
+
export default function ({ tsconfigPath = './tsconfig.json' } = {}) {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
ignores: ['node_modules/**', 'dist/**'],
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
files: ['**/*.ts'],
|
|
13
|
+
languageOptions: {
|
|
14
|
+
parser: tsParser,
|
|
15
|
+
parserOptions: {
|
|
16
|
+
ecmaVersion: 2020,
|
|
17
|
+
sourceType: 'module',
|
|
18
|
+
project: tsconfigPath,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
plugins: {
|
|
22
|
+
'@typescript-eslint': tsPlugin,
|
|
23
|
+
'unused-imports': unusedImportsPlugin,
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
27
|
+
//'linebreak-style': 'off', // Disable linebreak style rule
|
|
28
|
+
'@typescript-eslint/no-explicit-any': 'off', // Turn off the rule for no-explicit-any
|
|
29
|
+
|
|
30
|
+
/// coding guidelines
|
|
31
|
+
'brace-style': ['error', 'allman', { allowSingleLine: true }], // Use Allman style for braces
|
|
32
|
+
indent: ['error', 'tab', { SwitchCase: 1 }],
|
|
33
|
+
quotes: ['error', 'single'],
|
|
34
|
+
semi: ['error', 'always'],
|
|
35
|
+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
|
36
|
+
'no-trailing-spaces': 'error',
|
|
37
|
+
'eol-last': ['error', 'always'],
|
|
38
|
+
'comma-dangle': ['error', 'never'],
|
|
39
|
+
|
|
40
|
+
// naming conventions
|
|
41
|
+
'@typescript-eslint/naming-convention': [
|
|
42
|
+
'error',
|
|
43
|
+
{
|
|
44
|
+
selector: 'variableLike',
|
|
45
|
+
format: ['camelCase'],
|
|
46
|
+
leadingUnderscore: 'forbid',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
selector: 'function',
|
|
50
|
+
format: ['camelCase'],
|
|
51
|
+
leadingUnderscore: 'forbid',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
selector: 'class',
|
|
55
|
+
format: ['PascalCase'],
|
|
56
|
+
leadingUnderscore: 'forbid',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
selector: 'parameter',
|
|
60
|
+
format: ['camelCase'],
|
|
61
|
+
leadingUnderscore: 'forbid',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
selector: 'memberLike',
|
|
65
|
+
format: ['camelCase'],
|
|
66
|
+
leadingUnderscore: 'forbid',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
|
|
70
|
+
// unused-imports rules
|
|
71
|
+
'unused-imports/no-unused-imports-ts': 'error',
|
|
72
|
+
'unused-imports/no-unused-vars-ts': [
|
|
73
|
+
'warn',
|
|
74
|
+
{
|
|
75
|
+
vars: 'all',
|
|
76
|
+
varsIgnorePattern: '^_',
|
|
77
|
+
args: 'after-used',
|
|
78
|
+
argsIgnorePattern: '^_',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
2
|
+
"name": "@dmitryrechkin/eslint-standard",
|
|
3
|
+
"description": "This package provides a shared ESLint configuration which includes TypeScript support and a set of specific linting rules designed to ensure high-quality and consistent code style across projects.",
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"main": "eslint.config.mjs",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"postinstall": "echo 'Remember to install peer dependencies:\n npm install eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-unused-imports --save-dev\n bun add eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint-plugin-unused-imports --dev'"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"peerDependencies": {
|
|
13
|
+
"@typescript-eslint/eslint-plugin": "^7.9.0",
|
|
14
|
+
"@typescript-eslint/parser": "^7.9.0",
|
|
15
|
+
"eslint": "^8.57.0",
|
|
16
|
+
"eslint-plugin-unused-imports": "^3.2.0"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/eslint-config.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
module.exports = ({ tsconfigPath = './tsconfig.json' } = {}) => ({
|
|
2
|
-
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
|
|
3
|
-
extends: [
|
|
4
|
-
'eslint:recommended', // Uses the recommended rules from ESLint
|
|
5
|
-
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
|
|
6
|
-
],
|
|
7
|
-
plugins: [
|
|
8
|
-
'unused-imports'
|
|
9
|
-
],
|
|
10
|
-
parserOptions: {
|
|
11
|
-
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
|
|
12
|
-
sourceType: 'module', // Allows for the use of imports
|
|
13
|
-
project: tsconfigPath, // It has to include current folder name, because it falls back to the root folder otherwise
|
|
14
|
-
},
|
|
15
|
-
rules: {
|
|
16
|
-
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
|
|
17
|
-
'@typescript-eslint/explicit-function-return-type': 'error',
|
|
18
|
-
//'linebreak-style': 'off', // Disable linebreak style rule
|
|
19
|
-
'@typescript-eslint/no-explicit-any': 'off', // Turn off the rule for no-explicit-any
|
|
20
|
-
|
|
21
|
-
/// coding guidelines
|
|
22
|
-
'brace-style': ['error', 'allman', { 'allowSingleLine': true }], // Use Allman style for braces
|
|
23
|
-
'indent': ['error', 'tab', { 'SwitchCase': 1 }],
|
|
24
|
-
'quotes': ['error', 'single'],
|
|
25
|
-
'semi': ['error', 'always'],
|
|
26
|
-
'@typescript-eslint/no-unused-vars': ['error', { 'argsIgnorePattern': '^_' }],
|
|
27
|
-
'no-trailing-spaces': 'error',
|
|
28
|
-
'eol-last': ['error', 'always'],
|
|
29
|
-
'comma-dangle': ['error', 'never'],
|
|
30
|
-
|
|
31
|
-
// naming conventions
|
|
32
|
-
'@typescript-eslint/naming-convention': [
|
|
33
|
-
'error',
|
|
34
|
-
{
|
|
35
|
-
selector: 'variableLike',
|
|
36
|
-
format: ['camelCase'],
|
|
37
|
-
leadingUnderscore: 'forbid'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
selector: 'function',
|
|
41
|
-
format: ['camelCase'],
|
|
42
|
-
leadingUnderscore: 'forbid'
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
selector: 'class',
|
|
46
|
-
format: ['PascalCase'],
|
|
47
|
-
leadingUnderscore: 'forbid'
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
selector: 'parameter',
|
|
51
|
-
format: ['camelCase'],
|
|
52
|
-
leadingUnderscore: 'forbid'
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
selector: 'memberLike',
|
|
56
|
-
format: ['camelCase'],
|
|
57
|
-
leadingUnderscore: 'forbid'
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
|
|
61
|
-
// unused-imports rules
|
|
62
|
-
'unused-imports/no-unused-imports-ts': 'error',
|
|
63
|
-
'unused-imports/no-unused-vars-ts': [
|
|
64
|
-
'warn',
|
|
65
|
-
{
|
|
66
|
-
vars: 'all',
|
|
67
|
-
varsIgnorePattern: '^_',
|
|
68
|
-
args: 'after-used',
|
|
69
|
-
argsIgnorePattern: '^_'
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
});
|