@niondigital/eslint-config-base 1.2.0

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/.eslintrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "./index.js"
3
+ }
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 nion digital GmbH, Germany
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # `@niondigital/eslint-config-base`
2
+
3
+ This package provides an eslint config as used by nion digital as an extensible shared config.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npx install-peerdeps --dev @niondigital/eslint-config-base
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Extend local eslint configuration with `@niondigital/eslint-config-base`:
14
+
15
+ ```json
16
+ {
17
+ "extends": "@niondigital/eslint-config-base",
18
+ "rules": {}
19
+ }
20
+ ```
package/index.js ADDED
@@ -0,0 +1,138 @@
1
+ /* eslint-env node */
2
+ module.exports = {
3
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'eslint-config-airbnb'],
4
+ parser: '@typescript-eslint/parser',
5
+ plugins: ['@typescript-eslint', 'eslint-plugin-unused-imports'],
6
+ rules: {
7
+ 'comma-dangle': 'off',
8
+ // use tabs for indentation
9
+ indent: 0,
10
+ 'no-tabs': 0,
11
+ // allow imports without file extensions
12
+ 'import/extensions': ['error', 'always', { js: 'never', ts: 'never' }],
13
+ // require leading spaces in comments
14
+ 'spaced-comment': [
15
+ 'error',
16
+ 'always',
17
+ {
18
+ markers: ['/']
19
+ }
20
+ ],
21
+ 'import/prefer-default-export': 0,
22
+
23
+ '@typescript-eslint/indent': ['error', 'tab'],
24
+
25
+ 'no-use-before-define': 0,
26
+
27
+ // allow long lines
28
+ 'max-len': 0,
29
+
30
+ // handle redeclares via typescript-eslint
31
+ 'no-redeclare': 'off',
32
+ '@typescript-eslint/no-redeclare': 'error',
33
+
34
+ // naming conventions
35
+ camelcase: 'off',
36
+ '@typescript-eslint/naming-convention': [
37
+ 'error',
38
+ {
39
+ selector: 'default',
40
+ format: ['camelCase']
41
+ },
42
+ {
43
+ selector: 'variable',
44
+ format: ['camelCase', 'UPPER_CASE']
45
+ },
46
+ {
47
+ selector: 'parameter',
48
+ format: ['camelCase'],
49
+ leadingUnderscore: 'allow'
50
+ },
51
+ {
52
+ selector: 'memberLike',
53
+ format: ['camelCase', 'PascalCase', 'UPPER_CASE'],
54
+ leadingUnderscore: 'allow'
55
+ },
56
+ {
57
+ selector: 'typeLike',
58
+ format: ['PascalCase']
59
+ }
60
+ /*
61
+ {
62
+ selector: 'interface',
63
+ format: ['PascalCase'],
64
+ prefix: ['I']
65
+ }
66
+ */
67
+ ],
68
+
69
+ // types
70
+ '@typescript-eslint/no-explicit-any': 'off',
71
+ '@typescript-eslint/no-inferrable-types': 'off',
72
+
73
+ // member accessibility
74
+ '@typescript-eslint/explicit-member-accessibility': 'error',
75
+
76
+ // unused vars
77
+ 'no-unused-vars': 'off',
78
+ '@typescript-eslint/no-unused-vars': 'off',
79
+ 'unused-imports/no-unused-imports': 'error',
80
+ 'unused-imports/no-unused-vars': [
81
+ 'warn',
82
+ {
83
+ vars: 'all',
84
+ varsIgnorePattern: '^_',
85
+ args: 'after-used',
86
+ argsIgnorePattern: '^_'
87
+ }
88
+ ],
89
+
90
+ // use of semicolons
91
+ semi: 'off',
92
+ '@typescript-eslint/semi': ['error']
93
+ },
94
+ overrides: [
95
+ {
96
+ files: ['**/__tests__/*.{j,t}s?(x)', '**/tests/unit/**/*.spec.{j,t}s?(x)'],
97
+ env: {
98
+ jest: true
99
+ }
100
+ },
101
+ // .js files (including config files in the package root directory) are likely to not be included
102
+ // in the tsconfig.json file. So we can't parse them with the regular parser as this would fail
103
+ // as it requires all linted files to be included in tsconfig
104
+ {
105
+ files: ['./*.js', './.*.js', '**/*.js', '**/.*.js'],
106
+ parserOptions: {
107
+ parser: 'espree'
108
+ },
109
+ rules: {
110
+ '@typescript-eslint/explicit-function-return-type': 'off',
111
+ '@typescript-eslint/naming-convention': 'off',
112
+ 'import/no-unresolved': 'off'
113
+ }
114
+ },
115
+ // handle storybook config files indentation issues
116
+ {
117
+ files: ['./*.stories.js', './.*.stories.js', '**/*.stories.js', '**/.*.stories.js'],
118
+ parserOptions: {
119
+ parser: 'espree'
120
+ },
121
+ rules: {
122
+ '@typescript-eslint/indent': 'off',
123
+ 'prettier/prettier': 'off'
124
+ }
125
+ }
126
+ ],
127
+ settings: {
128
+ 'import/resolver': {
129
+ typescript: {},
130
+ node: {
131
+ extensions: ['.js', '.jsx', '.ts', '.tsx']
132
+ }
133
+ },
134
+ 'import/parsers': {
135
+ '@typescript-eslint/parser': ['.ts', '.tsx']
136
+ }
137
+ }
138
+ };
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@niondigital/eslint-config-base",
3
+ "version": "1.2.0",
4
+ "description": "niondigital base eslint config",
5
+ "keywords": [
6
+ "eslint",
7
+ "config",
8
+ "eslintconfig"
9
+ ],
10
+ "author": "David Seibert <david.seibert@nion-digital.com>",
11
+ "homepage": "https://github.com/niondigital/javascript-style",
12
+ "license": "MIT",
13
+ "main": "index.js",
14
+ "exports": {
15
+ ".": "./index.js",
16
+ "./.editorconfig": "./.editorconfig"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/niondigital/javascript-style.git"
21
+ },
22
+ "scripts": {
23
+ "lint": "eslint .",
24
+ "lint:fix": "eslint . --fix"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/niondigital/javascript-style/issues"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "devDependencies": {
33
+ "@babel/runtime": "^7.23.9",
34
+ "@eslint/js": "^9.3.0",
35
+ "@types/eslint__js": "^8.42.3",
36
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
37
+ "babel-preset-airbnb": "^4.5.0",
38
+ "babel-tape-runner": "^3.0.0",
39
+ "eclint": "^2.8.1",
40
+ "eslint": "^8.57.0",
41
+ "eslint-config-airbnb": "^19.0.4",
42
+ "eslint-find-rules": "^4.1.0",
43
+ "eslint-import-resolver-typescript": "^3.6.1",
44
+ "eslint-plugin-import": "^2.29.1",
45
+ "eslint-plugin-unused-imports": "^4.1.3",
46
+ "in-publish": "^2.0.1",
47
+ "safe-publish-latest": "^2.0.0",
48
+ "typescript": "^5.4.5",
49
+ "typescript-eslint": "^7.11.0"
50
+ },
51
+ "peerDependencies": {
52
+ "@typescript-eslint/eslint-plugin": "^7.15.0",
53
+ "eslint": "^8.2.0",
54
+ "eslint-config-airbnb": "^19.0.4",
55
+ "eslint-import-resolver-typescript": "^3.6.1",
56
+ "eslint-plugin-import": "^2.29.1"
57
+ },
58
+ "engines": {
59
+ "node": ">=18.0.0"
60
+ },
61
+ "gitHead": "0307c2691964ad304f62c86b64872deb1ecf290f"
62
+ }