@jiakun-zhao/eslint-config 1.1.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.
Files changed (3) hide show
  1. package/README.md +42 -0
  2. package/dist/index.cjs +141 -0
  3. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,42 @@
1
+ ## @jiakun-zhao/eslint-config
2
+
3
+ <br />
4
+
5
+ ![npm](https://img.shields.io/npm/v/@jiakun-zhao/eslint-config?color=%236054ba)
6
+
7
+ #### Usage
8
+
9
+ 1. Install the package
10
+
11
+ ```bash
12
+ ni -D @jiakun-zhao/eslint-config
13
+ ```
14
+
15
+ 2. Add the following to your `package.json` file
16
+
17
+ ```json
18
+ {
19
+ "eslintConfig": {
20
+ "extends": "@jiakun-zhao"
21
+ }
22
+ }
23
+ ```
24
+
25
+ 3. Add the following to your `.vscode/settings.json` file
26
+
27
+ ```json
28
+ {
29
+ "editor.codeActionsOnSave": {
30
+ "source.fixAll.eslint": true
31
+ },
32
+ "editor.formatOnSave": false,
33
+ // "prettier.enable": false,
34
+ "eslint.validate": [
35
+ "javascript",
36
+ "javascriptreact",
37
+ "typescript",
38
+ "typescriptreact",
39
+ "vue"
40
+ ]
41
+ }
42
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1,141 @@
1
+ 'use strict';
2
+
3
+ const ignorePatterns = [
4
+ "dist",
5
+ "output",
6
+ "out",
7
+ "public",
8
+ "temp",
9
+ "coverage",
10
+ "LICENSE*",
11
+ "Dockerfile",
12
+ "CHANGELOG.md",
13
+ "package-lock.json",
14
+ "pnpm-lock.yaml",
15
+ "yarn.lock",
16
+ "*.min.*",
17
+ "*.d.ts",
18
+ "*.css",
19
+ "*.png",
20
+ "*.ico",
21
+ "*.toml",
22
+ "*.patch",
23
+ "*.txt",
24
+ "*.crt",
25
+ "*.key",
26
+ "!.github",
27
+ "!.vitepress",
28
+ "!.vscode"
29
+ ];
30
+
31
+ const index = {
32
+ plugins: [
33
+ "unused-imports"
34
+ ],
35
+ extends: [
36
+ "standard",
37
+ "plugin:import/recommended",
38
+ "plugin:import/typescript",
39
+ "plugin:@typescript-eslint/recommended"
40
+ ],
41
+ settings: {
42
+ "import/resolver": {
43
+ node: {
44
+ extensions: [".js", ".jsx", ".mjs", ".ts", ".tsx", ".d.ts"]
45
+ }
46
+ }
47
+ },
48
+ ignorePatterns,
49
+ overrides: [
50
+ {
51
+ files: ["*.vue"],
52
+ extends: ["plugin:vue/vue3-recommended"],
53
+ parser: "vue-eslint-parser",
54
+ parserOptions: {
55
+ parser: "@typescript-eslint/parser"
56
+ },
57
+ rules: {
58
+ "vue/component-tags-order": ["error", { order: ["script", "template", "style"] }],
59
+ "vue/padding-line-between-blocks": ["error", "always"],
60
+ "vue/singleline-html-element-content-newline": "off",
61
+ "vue/max-attributes-per-line": "off",
62
+ "vue/html-self-closing": "off",
63
+ "vue/multi-word-component-names": "off",
64
+ "vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
65
+ "vue/object-curly-spacing": ["error", "always"]
66
+ }
67
+ },
68
+ {
69
+ files: ["*.jsx", "*.tsx"],
70
+ extends: [
71
+ "plugin:react/all"
72
+ ],
73
+ parserOptions: {
74
+ ecmaFeatures: {
75
+ jsx: true
76
+ }
77
+ },
78
+ rules: {
79
+ "react/react-in-jsx-scope": "off",
80
+ "react/no-unknown-property": "off",
81
+ "react/self-closing-comp": "off",
82
+ "react/destructuring-assignment": "off",
83
+ "react/no-multi-comp": "off",
84
+ "react/function-component-definition": "off",
85
+ "react/display-name": "off",
86
+ "react/jsx-indent": ["error", 2],
87
+ "react/jsx-indent-props": ["error", 2],
88
+ "react/jsx-filename-extension": "off",
89
+ "react/jsx-no-literals": "off",
90
+ "react/jsx-max-props-per-line": "off",
91
+ // 'react/jsx-space-before-closing': ['error', 'always'],
92
+ "react/jsx-tag-spacing": ["error", {
93
+ closingSlash: "never",
94
+ beforeSelfClosing: "always",
95
+ afterOpening: "never",
96
+ beforeClosing: "never"
97
+ }],
98
+ "react/jsx-newline": "off",
99
+ "react/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
100
+ "react/jsx-curly-spacing": ["error", { when: "never", children: { when: "never" } }]
101
+ }
102
+ },
103
+ {
104
+ files: ["*.astro"],
105
+ extends: ["plugin:astro/recommended"],
106
+ parser: "astro-eslint-parser",
107
+ parserOptions: {
108
+ parser: "@typescript-eslint/parser",
109
+ extraFileExtensions: [".astro"]
110
+ }
111
+ }
112
+ ],
113
+ rules: {
114
+ // newline
115
+ "array-bracket-newline": ["error", "consistent"],
116
+ "array-element-newline": ["error", "consistent"],
117
+ // import
118
+ "import/no-unresolved": "off",
119
+ "unused-imports/no-unused-imports": "error",
120
+ "import/order": "error",
121
+ "sort-imports": ["error", {
122
+ ignoreCase: false,
123
+ ignoreDeclarationSort: true,
124
+ ignoreMemberSort: false,
125
+ memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
126
+ allowSeparatedGroups: false
127
+ }],
128
+ // spacing
129
+ "key-spacing": ["error", { beforeColon: false, afterColon: true }],
130
+ "switch-colon-spacing": ["error", { before: false, after: true }],
131
+ "space-before-function-paren": ["error", "never"],
132
+ "@typescript-eslint/type-annotation-spacing": ["error", { before: false, after: true }],
133
+ // quote
134
+ "quote-props": ["error", "consistent-as-needed"],
135
+ // comma
136
+ "comma-dangle": ["error", "always-multiline"],
137
+ "@typescript-eslint/comma-dangle": ["error", "always-multiline"]
138
+ }
139
+ };
140
+
141
+ module.exports = index;
package/package.json ADDED
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "@jiakun-zhao/eslint-config",
3
+ "version": "1.1.0",
4
+ "description": "Jiakun's ESLint config.",
5
+ "keywords": [
6
+ "eslint-config"
7
+ ],
8
+ "homepage": "https://github.com/jiakun-zhao/eslint-config",
9
+ "license": "MIT",
10
+ "author": "Jiakun Zhao <hi@zhaojiakun.com>",
11
+ "main": "dist/index.cjs",
12
+ "files": [
13
+ "dist/index.cjs",
14
+ "package.json"
15
+ ],
16
+ "eslintConfig": {
17
+ "extends": "./dist/index.cjs"
18
+ },
19
+ "dependencies": {
20
+ "@typescript-eslint/eslint-plugin": "^6.1.0",
21
+ "@typescript-eslint/parser": "^6.1.0",
22
+ "eslint-config-standard": "^17.1.0",
23
+ "eslint-plugin-astro": "^0.27.2",
24
+ "eslint-plugin-import": "^2.27.5",
25
+ "eslint-plugin-n": "^16.0.1",
26
+ "eslint-plugin-promise": "^6.1.1",
27
+ "eslint-plugin-react": "^7.32.2",
28
+ "eslint-plugin-unused-imports": "^3.0.0",
29
+ "eslint-plugin-vue": "^9.15.1",
30
+ "vue-eslint-parser": "^9.3.1"
31
+ },
32
+ "devDependencies": {
33
+ "@types/eslint": "^8.44.0",
34
+ "@types/node": "^20.4.2",
35
+ "bumpp": "^9.1.1",
36
+ "eslint": "^8.45.0",
37
+ "typescript": "^5.1.6",
38
+ "unbuild": "^1.2.1"
39
+ },
40
+ "peerDependencies": {
41
+ "eslint": ">=7.4.0"
42
+ },
43
+ "packageManager": "pnpm@8.6.8",
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "registry": "https://registry.npmjs.org/"
47
+ },
48
+ "scripts": {
49
+ "build": "unbuild",
50
+ "release": "bumpp && pnpm publish",
51
+ "stub": "unbuild --stub"
52
+ }
53
+ }