@aneuhold/eslint-config 1.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/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # eslint-config
2
+ Personal ESLint Configuration
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@aneuhold/eslint-config",
3
+ "version": "1.0.1",
4
+ "description": "Main ESLint Configuration for personal projects",
5
+ "main": "src/index.js",
6
+ "packageManager": "yarn@4.2.2",
7
+ "scripts": {
8
+ "pushpub": "npm version patch && git push && npm publish --access public",
9
+ "upgrade:all": "yarn upgrade --latest",
10
+ "lint": "eslint"
11
+ },
12
+ "type": "module",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/aneuhold/eslint-config.git"
16
+ },
17
+ "keywords": [
18
+ "eslint",
19
+ "eslintconfig"
20
+ ],
21
+ "author": "Anton G. Neuhold Jr.",
22
+ "license": "MIT",
23
+ "bugs": {
24
+ "url": "https://github.com/aneuhold/eslint-config/issues"
25
+ },
26
+ "homepage": "https://github.com/aneuhold/eslint-config#readme",
27
+ "files": [
28
+ "src/**/*"
29
+ ],
30
+ "peerDependencies": {
31
+ "eslint": ">= 9"
32
+ },
33
+ "dependencies": {
34
+ "@typescript-eslint/eslint-plugin": "^7.8.0",
35
+ "@typescript-eslint/parser": "^7.8.0",
36
+ "eslint-config-prettier": "^8.3.0",
37
+ "eslint-plugin-import": "^2.22.1",
38
+ "eslint-plugin-prettier": "^5.1.3",
39
+ "eslint-plugin-svelte": "^2.39.0",
40
+ "prettier-plugin-svelte": "^3.2.3",
41
+ "typescript-eslint": "^7.8.0"
42
+ },
43
+ "devDependencies": {
44
+ "eslint": "^9",
45
+ "prettier": "^3.2.5",
46
+ "typescript": "^4.4.3"
47
+ }
48
+ }
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import svelteConfig from './svelte.config';
2
+ import tsLibConfig from './ts-lib-config';
3
+
4
+ // Export all the configs from this library
5
+ export { svelteConfig, tsLibConfig };
@@ -0,0 +1,106 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
5
+ import eslintPluginSvelte from 'eslint-plugin-svelte';
6
+ import globals from 'globals';
7
+ import svelteParser from 'svelte-eslint-parser';
8
+ import tseslint from 'typescript-eslint';
9
+
10
+ // Take notes on the svelte-eslint-parser and the parser options it provides
11
+ // Also test creating a single combined config for all files.
12
+ // This GitHub issue might be helpful: https://github.com/typescript-eslint/typescript-eslint/issues/6778
13
+
14
+ const defaultConfig = tseslint.config(
15
+ {
16
+ files: ['**/*.js', '**/*.ts', '**/*.svelte'],
17
+ extends: [
18
+ eslint.configs.recommended,
19
+ ...tseslint.configs.strictTypeChecked,
20
+ eslintPluginPrettierRecommended
21
+ ],
22
+ languageOptions: {
23
+ parser: tseslint.parser,
24
+ parserOptions: {
25
+ sourceType: 'module',
26
+ extraFileExtensions: ['.svelte'],
27
+ project: true
28
+ },
29
+ globals: { ...globals.browser, ...globals.node }
30
+ },
31
+ // Rules for js, and ts in ts files and svelte files
32
+ //don't set 'svelte/*' rules here
33
+ rules: {
34
+ 'no-use-before-define': 'off',
35
+ 'no-undef': 'off',
36
+ // Just 100% disagree with this rule. The reasoning is that using a
37
+ // specific class name allows for you to write the class name and it
38
+ // will automatically bring in that class along with all the methods.
39
+ // This provides context to what the class is doing, and allows for
40
+ // better code completion + refactoring.
41
+ '@typescript-eslint/no-extraneous-class': 'off',
42
+ '@typescript-eslint/restrict-template-expressions': [
43
+ 'error',
44
+ {
45
+ allowNumber: true,
46
+ allowBoolean: true
47
+ }
48
+ ],
49
+ // ❗️ This should really be turned back on. It is turned off for now,
50
+ // because it seems that the type definitions on the backend are wrong.
51
+ // Types that have objects with variable key names should be updated
52
+ // so that the value is not always defined. AKA the value is optional.
53
+ '@typescript-eslint/no-unnecessary-condition': 'warn',
54
+ // Disabled because when using MongoDB, there aren't many options for
55
+ // data structures besides JSON objects.
56
+ '@typescript-eslint/no-dynamic-delete': 'off',
57
+ // Disabled because on the frontend, it isn't always necessary to await
58
+ // a promise.
59
+ '@typescript-eslint/no-floating-promises': 'off',
60
+ // The below have to be disabled because of the issue with svelte TS
61
+ // types not being recognized in TS files, and vice versa.
62
+ '@typescript-eslint/no-unsafe-member-access': 'off',
63
+ '@typescript-eslint/no-unsafe-call': 'off',
64
+ '@typescript-eslint/no-unsafe-return': 'off',
65
+ '@typescript-eslint/no-unsafe-assignment': 'off'
66
+ }
67
+ },
68
+ {
69
+ // disable type-aware linting on JS files
70
+ files: ['**/*.js'],
71
+ extends: [tseslint.configs.disableTypeChecked]
72
+ }
73
+ );
74
+
75
+ const svelteConfig = tseslint.config({
76
+ files: ['**/*.svelte'],
77
+ // @ts-expect-error - eslint-plugin-svelte is not typed
78
+ extends: [
79
+ ...eslintPluginSvelte.configs['flat/recommended'],
80
+ ...eslintPluginSvelte.configs['flat/prettier']
81
+ ],
82
+ languageOptions: {
83
+ parser: svelteParser,
84
+ parserOptions: {
85
+ parser: tseslint.parser,
86
+ sourceType: 'module',
87
+ extraFileExtensions: ['.svelte'],
88
+ project: true
89
+ }
90
+ },
91
+ // Svelte Rules
92
+ /** @type {import('eslint').Linter.RulesRecord} */
93
+ rules: {
94
+ // 'svelte/valid-compile': ['warn']
95
+ }
96
+ });
97
+
98
+ /** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray} */
99
+ export default [
100
+ ...defaultConfig,
101
+ ...svelteConfig,
102
+ {
103
+ // other override settings. e.g. for `files: ['**/*.test.*']`
104
+ },
105
+ { ignores: ['.svelte-kit', '.yarn', 'build', 'node_modules', '**/.DS_Store'] } // overrides global ignores
106
+ ];
@@ -0,0 +1,57 @@
1
+ // @ts-check
2
+
3
+ import eslint from '@eslint/js';
4
+ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
5
+ import globals from 'globals';
6
+ import tseslint from 'typescript-eslint';
7
+
8
+ const defaultConfig = tseslint.config(
9
+ {
10
+ files: ['**/*.js', '**/*.mjs', '**/*.ts'],
11
+ extends: [
12
+ eslint.configs.recommended,
13
+ ...tseslint.configs.strictTypeChecked,
14
+ eslintPluginPrettierRecommended
15
+ ],
16
+ languageOptions: {
17
+ parser: tseslint.parser,
18
+ parserOptions: {
19
+ sourceType: 'commonjs',
20
+ project: true
21
+ },
22
+ globals: { ...globals.node }
23
+ },
24
+ // Rules for js, and ts in ts files
25
+ rules: {
26
+ 'no-use-before-define': 'off',
27
+ 'no-undef': 'off',
28
+ // Just 100% disagree with this rule. The reasoning is that using a
29
+ // specific class name allows for you to write the class name and it
30
+ // will automatically bring in that class along with all the methods.
31
+ // This provides context to what the class is doing, and allows for
32
+ // better code completion + refactoring.
33
+ '@typescript-eslint/no-extraneous-class': 'off',
34
+ '@typescript-eslint/restrict-template-expressions': [
35
+ 'error',
36
+ {
37
+ allowNumber: true,
38
+ allowBoolean: true
39
+ }
40
+ ]
41
+ }
42
+ },
43
+ {
44
+ // disable type-aware linting on JS files
45
+ files: ['**/*.js', '**/*.mjs'],
46
+ extends: [tseslint.configs.disableTypeChecked]
47
+ }
48
+ );
49
+
50
+ /** @type {import('@typescript-eslint/utils').TSESLint.FlatConfig.ConfigArray} */
51
+ export default [
52
+ ...defaultConfig,
53
+ {
54
+ // other override settings. e.g. for `files: ['**/*.test.*']`
55
+ },
56
+ { ignores: ['.yarn', 'build', 'lib', 'node_modules', '**/.DS_Store'] } // overrides global ignores
57
+ ];