@juanmsl/eslint-config 0.0.8

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 (4) hide show
  1. package/library.js +34 -0
  2. package/next.js +34 -0
  3. package/package.json +34 -0
  4. package/react.js +165 -0
package/library.js ADDED
@@ -0,0 +1,34 @@
1
+ const { resolve } = require('node:path');
2
+
3
+ const project = resolve(process.cwd(), 'tsconfig.json');
4
+
5
+ /** @type {import("eslint").Linter.Config} */
6
+ module.exports = {
7
+ extends: [
8
+ 'eslint:recommended',
9
+ 'plugin:@typescript-eslint/recommended',
10
+ 'plugin:@typescript-eslint/eslint-recommended',
11
+ 'plugin:prettier/recommended',
12
+ 'prettier',
13
+ ],
14
+ plugins: ['@typescript-eslint', 'import', 'prefer-arrow', 'prettier'],
15
+ env: {
16
+ browser: true,
17
+ es6: true,
18
+ node: true,
19
+ },
20
+ settings: {
21
+ 'import/resolver': {
22
+ typescript: {
23
+ project,
24
+ },
25
+ },
26
+ },
27
+ ignorePatterns: [
28
+ // Ignore dotfiles
29
+ '.*.js',
30
+ 'node_modules/',
31
+ 'dist/',
32
+ ],
33
+ overrides: [{ files: ['*.js?(x)', '*.ts?(x)'] }],
34
+ };
package/next.js ADDED
@@ -0,0 +1,34 @@
1
+ const { resolve } = require('node:path');
2
+
3
+ const project = resolve(process.cwd(), 'tsconfig.json');
4
+
5
+ /** @type {import("eslint").Linter.Config} */
6
+ module.exports = {
7
+ extends: [
8
+ './react.js',
9
+ 'prettier',
10
+ require.resolve('@vercel/style-guide/eslint/next')
11
+ ],
12
+ globals: {
13
+ React: true,
14
+ JSX: true,
15
+ },
16
+ env: {
17
+ node: true,
18
+ browser: true,
19
+ },
20
+ plugins: ['only-warn'],
21
+ settings: {
22
+ 'import/resolver': {
23
+ typescript: {
24
+ project,
25
+ },
26
+ },
27
+ },
28
+ ignorePatterns: [
29
+ // Ignore dotfiles
30
+ '.*.js',
31
+ 'node_modules/',
32
+ ],
33
+ overrides: [{ files: ['*.js?(x)', '*.ts?(x)'] }],
34
+ };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@juanmsl/eslint-config",
3
+ "version": "0.0.8",
4
+ "files": [
5
+ "react.js",
6
+ "library.js",
7
+ "next.js",
8
+ "react-internal.js"
9
+ ],
10
+ "license": "MIT",
11
+ "scripts": {
12
+ "publish-package": "yarn publish --no-git-tag-version"
13
+ },
14
+ "dependencies": {
15
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
16
+ "@typescript-eslint/parser": "^7.4.0",
17
+ "@vercel/style-guide": "^5.1.0",
18
+ "eslint": "^8.57.0",
19
+ "eslint-config-prettier": "^9.0.0",
20
+ "eslint-import-resolver-typescript": "^3.6.1",
21
+ "eslint-plugin-import": "^2.28.1",
22
+ "eslint-plugin-only-warn": "^1.1.0",
23
+ "eslint-plugin-prefer-arrow": "^1.2.3",
24
+ "eslint-plugin-prettier": "^5.0.0",
25
+ "eslint-plugin-react": "^7.33.2",
26
+ "eslint-plugin-react-hooks": "^4.6.0",
27
+ "eslint-plugin-react-refresh": "^0.4.3",
28
+ "prettier": "^3.0.3",
29
+ "typescript": "^5.5.4"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ }
34
+ }
package/react.js ADDED
@@ -0,0 +1,165 @@
1
+ const { resolve } = require('node:path');
2
+
3
+ const project = resolve(process.cwd(), 'tsconfig.json');
4
+
5
+ /** @type {import("eslint").Linter.Config} */
6
+ module.exports = {
7
+ extends: [
8
+ 'eslint:recommended',
9
+ 'plugin:@typescript-eslint/recommended',
10
+ 'plugin:@typescript-eslint/eslint-recommended',
11
+ 'plugin:react-hooks/recommended',
12
+ 'plugin:react/recommended',
13
+ 'plugin:prettier/recommended',
14
+ 'prettier',
15
+ ],
16
+ plugins: [
17
+ '@typescript-eslint',
18
+ 'eslint-plugin-react',
19
+ 'eslint-plugin-prettier',
20
+ 'eslint-plugin-react-hooks',
21
+ 'import',
22
+ 'prefer-arrow',
23
+ 'prettier',
24
+ 'react-hooks',
25
+ 'react-refresh',
26
+ ],
27
+ parser: '@typescript-eslint/parser',
28
+ parserOptions: {
29
+ ecmaVersion: 'latest',
30
+ sourceType: 'module',
31
+ ecmaFeatures: {
32
+ jsx: true,
33
+ },
34
+ },
35
+ env: {
36
+ browser: true,
37
+ es6: true,
38
+ node: true,
39
+ },
40
+ settings: {
41
+ 'import/resolver': {
42
+ typescript: {
43
+ project,
44
+ },
45
+ },
46
+ react: {
47
+ version: 'detect',
48
+ },
49
+ },
50
+ globals: {
51
+ React: true,
52
+ JSX: true,
53
+ },
54
+ ignorePatterns: ['dist', '!**/*', '**/node_modules/**', '*.js', '*.d.ts'],
55
+ rules: {
56
+ '@typescript-eslint/array-type': ['error', { default: 'generic' }],
57
+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
58
+ '@typescript-eslint/no-explicit-any': ['error'],
59
+ '@typescript-eslint/ban-types': ['off'],
60
+ 'array-callback-return': 'error',
61
+ eqeqeq: ['error', 'always'],
62
+ 'guard-for-in': 'warn',
63
+ 'import/no-default-export': 'off',
64
+ 'import/no-named-as-default': 'error',
65
+ 'import/no-named-default': 'error',
66
+ 'import/no-namespace': 'error',
67
+ 'import/no-self-import': 'error',
68
+ 'import/export': 'error',
69
+ 'import/exports-last': 'off',
70
+ 'import/first': 'error',
71
+ 'import/group-exports': 'off',
72
+ 'import/newline-after-import': 'error',
73
+ 'import/no-absolute-path': 'error',
74
+ 'import/no-cycle': ['error', { ignoreExternal: true }],
75
+ 'import/no-deprecated': 'error',
76
+ 'import/no-extraneous-dependencies': ['error', { optionalDependencies: false }],
77
+ 'import/no-useless-path-segments': ['error', { noUselessIndex: true }],
78
+ 'import/no-webpack-loader-syntax': 'error',
79
+ 'import/prefer-default-export': 'off',
80
+ 'import/order': [
81
+ 'error',
82
+ {
83
+ 'newlines-between': 'always',
84
+ warnOnUnassignedImports: true,
85
+ groups: ['builtin', 'external', 'parent', 'sibling', 'internal', 'index', 'object', 'type', 'unknown'],
86
+ pathGroups: [
87
+ {
88
+ pattern: 'react',
89
+ group: 'external',
90
+ position: 'before',
91
+ },
92
+ ],
93
+ alphabetize: {
94
+ order: 'asc',
95
+ caseInsensitive: false,
96
+ },
97
+ },
98
+ ],
99
+ 'line-comment-position': ['error', 'above'],
100
+ 'multiline-comment-style': ['error', 'starred-block'],
101
+ 'no-confusing-arrow': 'off',
102
+ 'no-console': 'warn',
103
+ 'no-duplicate-imports': 'error',
104
+ 'no-empty': ['error', { allowEmptyCatch: true }],
105
+ 'no-implicit-globals': 'error',
106
+ 'no-invalid-this': 'error',
107
+ 'no-lone-blocks': 'error',
108
+ 'no-loop-func': 'error',
109
+ 'no-new': 'error',
110
+ 'no-promise-executor-return': 'error',
111
+ 'no-prototype-builtins': 'warn',
112
+ 'no-return-assign': 'error',
113
+ 'no-return-await': 'error',
114
+ 'no-template-curly-in-string': 'error',
115
+ 'no-throw-literal': 'error',
116
+ 'no-unreachable-loop': 'error',
117
+ 'no-unused-vars': 'off',
118
+ 'padding-line-between-statements': [
119
+ 'error',
120
+ { blankLine: 'always', prev: '*', next: 'return' },
121
+ { blankLine: 'always', prev: '*', next: 'continue' },
122
+ { blankLine: 'always', prev: '*', next: 'break' },
123
+ { blankLine: 'always', prev: '*', next: 'if' },
124
+ { blankLine: 'always', prev: 'if', next: '*' },
125
+ { blankLine: 'always', prev: 'while', next: '*' },
126
+ { blankLine: 'always', prev: '*', next: 'while' },
127
+ { blankLine: 'always', prev: 'switch', next: '*' },
128
+ { blankLine: 'always', prev: '*', next: 'switch' },
129
+ { blankLine: 'always', prev: 'for', next: '*' },
130
+ { blankLine: 'always', prev: '*', next: 'for' },
131
+ ],
132
+ 'prefer-arrow-callback': ['error'],
133
+ 'prefer-arrow/prefer-arrow-functions': 'off',
134
+ 'prettier/prettier': [
135
+ 'error',
136
+ {
137
+ printWidth: 120,
138
+ singleQuote: true,
139
+ useTabs: false,
140
+ tabWidth: 2,
141
+ semi: true,
142
+ arrowParens: 'avoid',
143
+ trailingComma: 'all',
144
+ jsxSingleQuote: true,
145
+ },
146
+ ],
147
+ quotes: ['error', 'single'],
148
+ 'react/destructuring-assignment': ['error', 'always'],
149
+ 'react/jsx-fragments': ['error', 'syntax'],
150
+ "react/jsx-no-target-blank": ['error', {
151
+ "allowReferrer": true,
152
+ }],
153
+ 'react/jsx-no-useless-fragment': 'off',
154
+ 'react/react-in-jsx-scope': 'off',
155
+ 'react/function-component-definition': [
156
+ 'error',
157
+ { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
158
+ ],
159
+ 'react-refresh/only-export-components': ['off', { allowConstantExport: true }],
160
+ 'react-hooks/rules-of-hooks': 'error',
161
+ 'react-hooks/exhaustive-deps': 'error',
162
+ semi: 'error',
163
+ yoda: 'error',
164
+ },
165
+ };