@squadus/eslint-config 0.0.1
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/.prettierrc.json +12 -0
- package/LICENSE +21 -0
- package/README.md +25 -0
- package/copyrightTemplate.js +7 -0
- package/index.js +28 -0
- package/package.json +40 -0
- package/rules/import.js +62 -0
- package/rules/lint.js +71 -0
- package/rules/node.js +12 -0
- package/rules/notice.js +31 -0
- package/rules/prettier.js +10 -0
- package/rules/react.js +14 -0
- package/rules/sort-keys.js +15 -0
package/.prettierrc.json
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 New Cloud Technologies
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Styling Tools
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
This plugin intends to unify styling for all squadus infrastructure. It contains ESLint and Prettier presets.
|
|
5
|
+
|
|
6
|
+
## How to use
|
|
7
|
+
For rules needs to import rules folder.
|
|
8
|
+
```javascript
|
|
9
|
+
// .eslintrc.js
|
|
10
|
+
module.exports = {
|
|
11
|
+
...
|
|
12
|
+
extends: ['@squadus/eslint-config'],
|
|
13
|
+
...
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
To extend rules simply add `rules` block after `extends`
|
|
17
|
+
|
|
18
|
+
Prettier can be imported to package.json
|
|
19
|
+
```javascript
|
|
20
|
+
{
|
|
21
|
+
"name": "your-package",
|
|
22
|
+
"prettier": "@squadus/eslint-config/.prettierrc.json",
|
|
23
|
+
...
|
|
24
|
+
}
|
|
25
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
package/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
env: {
|
|
11
|
+
browser: true,
|
|
12
|
+
commonjs: true,
|
|
13
|
+
es6: true,
|
|
14
|
+
jest: true,
|
|
15
|
+
node: true,
|
|
16
|
+
},
|
|
17
|
+
extends: [
|
|
18
|
+
'./rules/lint',
|
|
19
|
+
'./rules/node',
|
|
20
|
+
'./rules/sort-keys',
|
|
21
|
+
'./rules/notice',
|
|
22
|
+
'./rules/import',
|
|
23
|
+
'./rules/prettier',
|
|
24
|
+
'./rules/react',
|
|
25
|
+
].map(require.resolve),
|
|
26
|
+
ignorePatterns: ['**/copyrightTemplate.js', '**/.eslintrc.js'],
|
|
27
|
+
parser: '@typescript-eslint/parser',
|
|
28
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@squadus/eslint-config",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Package with eslint configuration",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20.x"
|
|
7
|
+
},
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
".prettierrc.json",
|
|
11
|
+
"README.md",
|
|
12
|
+
"rules",
|
|
13
|
+
"index.js",
|
|
14
|
+
"copyrightTemplate.js"
|
|
15
|
+
],
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@typescript-eslint/eslint-plugin": "5.59.0",
|
|
18
|
+
"@typescript-eslint/parser": "5.59.0",
|
|
19
|
+
"eslint": "8.36.0",
|
|
20
|
+
"eslint-config-prettier": "8.3.0",
|
|
21
|
+
"eslint-plugin-import": "2.31.0",
|
|
22
|
+
"eslint-plugin-notice": "1.0.0",
|
|
23
|
+
"eslint-plugin-prettier": "3.4.1",
|
|
24
|
+
"eslint-plugin-sort-keys": "2.3.5",
|
|
25
|
+
"eslint-plugin-typescript-sort-keys": "2.1.0",
|
|
26
|
+
"prettier": "3.5.3"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "5.59.0",
|
|
30
|
+
"@typescript-eslint/parser": "5.59.0",
|
|
31
|
+
"eslint": "8.36.0",
|
|
32
|
+
"eslint-config-prettier": "8.6.0",
|
|
33
|
+
"eslint-plugin-import": "2.32.0",
|
|
34
|
+
"eslint-plugin-notice": "1.0.0",
|
|
35
|
+
"eslint-plugin-prettier": "3.4.1",
|
|
36
|
+
"eslint-plugin-sort-keys": "2.3.5",
|
|
37
|
+
"eslint-plugin-typescript-sort-keys": "2.1.0",
|
|
38
|
+
"prettier": "3.8.1"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/rules/import.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
plugins: ['import'],
|
|
10
|
+
extends: ['plugin:import/recommended'],
|
|
11
|
+
rules: {
|
|
12
|
+
'import/default': 'error',
|
|
13
|
+
'import/named': 'error',
|
|
14
|
+
'import/namespace': 'off',
|
|
15
|
+
'import/no-duplicates': 'error',
|
|
16
|
+
'import/no-named-as-default-member': 'off',
|
|
17
|
+
'import/order': [
|
|
18
|
+
'error',
|
|
19
|
+
{
|
|
20
|
+
groups: [
|
|
21
|
+
'builtin',
|
|
22
|
+
'external',
|
|
23
|
+
'internal',
|
|
24
|
+
['index', 'sibling', 'parent'],
|
|
25
|
+
'object',
|
|
26
|
+
'type',
|
|
27
|
+
],
|
|
28
|
+
pathGroups: [
|
|
29
|
+
{
|
|
30
|
+
pattern: '@squadus/**',
|
|
31
|
+
group: 'external',
|
|
32
|
+
position: 'after',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
pattern: 'react*',
|
|
36
|
+
group: 'external',
|
|
37
|
+
position: 'before',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
pathGroupsExcludedImportTypes: ['builtin'],
|
|
41
|
+
'newlines-between': 'always',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
'no-restricted-imports': [
|
|
45
|
+
'error',
|
|
46
|
+
{
|
|
47
|
+
patterns: ['@squadus/mobileClient/**'],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
settings: {
|
|
53
|
+
'import/resolver': {
|
|
54
|
+
node: {
|
|
55
|
+
extensions: ['.mjs', '.js', '.json', '.ts', '.tsx'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
'import/parsers': {
|
|
59
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
package/rules/lint.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
|
|
10
|
+
plugins: ['@typescript-eslint', 'react-hooks'],
|
|
11
|
+
rules: {
|
|
12
|
+
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
13
|
+
'@typescript-eslint/naming-convention': [
|
|
14
|
+
'error',
|
|
15
|
+
{
|
|
16
|
+
format: null,
|
|
17
|
+
custom: {
|
|
18
|
+
regex: '^[a-zA-Z0-9-_/@$]+$',
|
|
19
|
+
match: true,
|
|
20
|
+
message:
|
|
21
|
+
'Only latin symbols and digits are allowed in naming',
|
|
22
|
+
},
|
|
23
|
+
// need to explain all of them otherwise there will be errors in config files such as this one
|
|
24
|
+
selector: [
|
|
25
|
+
'function',
|
|
26
|
+
'variable',
|
|
27
|
+
'class',
|
|
28
|
+
'classMethod',
|
|
29
|
+
'classProperty',
|
|
30
|
+
'enum',
|
|
31
|
+
'enumMember',
|
|
32
|
+
'interface',
|
|
33
|
+
'parameter',
|
|
34
|
+
'typeAlias',
|
|
35
|
+
'typeMethod',
|
|
36
|
+
'typeParameter',
|
|
37
|
+
'typeProperty',
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
'@typescript-eslint/no-dupe-class-members': 'error',
|
|
42
|
+
'@typescript-eslint/no-empty-function': ['error'],
|
|
43
|
+
'@typescript-eslint/no-explicit-any': 'error',
|
|
44
|
+
'@typescript-eslint/no-unused-vars': [
|
|
45
|
+
'error',
|
|
46
|
+
{
|
|
47
|
+
argsIgnorePattern: '^_',
|
|
48
|
+
varsIgnorePattern: '^_',
|
|
49
|
+
caughtErrorsIgnorePattern: '^_',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
'array-callback-return': 'error',
|
|
53
|
+
'comma-spacing': ['warn', { after: true, before: false }],
|
|
54
|
+
curly: 'error',
|
|
55
|
+
// require === and !== instead of == and != https://eslint.org/docs/latest/rules/eqeqeq
|
|
56
|
+
eqeqeq: 'error',
|
|
57
|
+
'max-params': ['error', 3],
|
|
58
|
+
'no-confusing-arrow': 'error',
|
|
59
|
+
'no-console': 'error',
|
|
60
|
+
// https://typescript-eslint.io/rules/no-dupe-class-members/
|
|
61
|
+
'no-dupe-class-members': 'off',
|
|
62
|
+
'no-else-return': 'error',
|
|
63
|
+
'no-extra-semi': 2,
|
|
64
|
+
'no-undef': 'error',
|
|
65
|
+
'react-hooks/immutability': 'warn',
|
|
66
|
+
'react-hooks/refs': 'warn',
|
|
67
|
+
'react-hooks/set-state-in-effect': 'warn',
|
|
68
|
+
'react-hooks/set-state-in-render': 'warn',
|
|
69
|
+
'react-hooks/static-components': 'warn',
|
|
70
|
+
},
|
|
71
|
+
};
|
package/rules/node.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
env: {
|
|
10
|
+
node: true,
|
|
11
|
+
},
|
|
12
|
+
};
|
package/rules/notice.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-var-requires*/
|
|
9
|
+
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
plugins: ['notice'],
|
|
14
|
+
rules: {
|
|
15
|
+
'notice/notice': [
|
|
16
|
+
'error',
|
|
17
|
+
{
|
|
18
|
+
messages: {
|
|
19
|
+
whenFailedToMatch:
|
|
20
|
+
"Couldn't find 'Copyright', are you sure you added it?",
|
|
21
|
+
},
|
|
22
|
+
nonMatchingTolerance: 1,
|
|
23
|
+
onNonMatchingHeader: 'replace',
|
|
24
|
+
templateFile: path.resolve(
|
|
25
|
+
__dirname,
|
|
26
|
+
'../copyrightTemplate.js',
|
|
27
|
+
),
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
extends: ['prettier'],
|
|
10
|
+
};
|
package/rules/react.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
plugins: ['eslint-plugin-react'],
|
|
11
|
+
rules: {
|
|
12
|
+
'react/jsx-no-bind': ['warn'],
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) New Cloud Technologies, Ltd., 2013-2026
|
|
3
|
+
*
|
|
4
|
+
* You can not use the contents of the file in any way without New Cloud Technologies, Ltd. written permission.
|
|
5
|
+
* To obtain such a permit, you should contact New Cloud Technologies, Ltd. at http://ncloudtech.com/contact.html
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
plugins: ['sort-keys'],
|
|
10
|
+
rules: {
|
|
11
|
+
'sort-exports/sort-exports': 'off',
|
|
12
|
+
'sort-keys': 0,
|
|
13
|
+
'sort-keys/sort-keys-fix': ['error', 'asc', { minKeys: 5 }],
|
|
14
|
+
},
|
|
15
|
+
};
|