eslint-config-badboyku 1.0.12

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.js ADDED
@@ -0,0 +1,126 @@
1
+ module.exports = {
2
+ globals: {
3
+ __DEV__: true,
4
+ },
5
+ env: {
6
+ browser: true,
7
+ commonjs: true,
8
+ es6: true,
9
+ node: true,
10
+ jest: true,
11
+ },
12
+ parserOptions: {
13
+ ecmaFeatures: { jsx: true },
14
+ sourceType: 'module',
15
+ },
16
+ extends: ['airbnb', 'airbnb/hooks', 'eslint:recommended', 'plugin:import/recommended', 'plugin:prettier/recommended'],
17
+ plugins: ['import', 'prettier'],
18
+ settings: {
19
+ 'import/resolver': { node: { extensions: ['.js', '.jsx', '.ts', '.tsx'] } },
20
+ },
21
+ overrides: [
22
+ {
23
+ files: ['**/*.[jt]sx'],
24
+ settings: {
25
+ react: { version: 'detect' },
26
+ },
27
+ extends: ['plugin:jsx-a11y/recommended', 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
28
+ plugins: ['jsx-a11y', 'react', 'react-hooks'],
29
+ rules: {
30
+ 'jsx-a11y/alt-text': 'warn',
31
+ 'jsx-a11y/anchor-has-content': 'warn',
32
+ 'jsx-a11y/anchor-is-valid': 'warn',
33
+ 'jsx-a11y/aria-activedescendant-has-tabindex': 'warn',
34
+ 'jsx-a11y/aria-props': 'warn',
35
+ 'jsx-a11y/aria-proptypes': 'warn',
36
+ 'jsx-a11y/aria-role': 'warn',
37
+ 'jsx-a11y/aria-unsupported-elements': 'warn',
38
+ 'jsx-a11y/click-events-have-key-events': 'warn',
39
+ 'jsx-a11y/heading-has-content': 'warn',
40
+ 'jsx-a11y/iframe-has-title': 'warn',
41
+ 'jsx-a11y/img-redundant-alt': 'warn',
42
+ 'jsx-a11y/interactive-supports-focus': 'warn',
43
+ 'jsx-a11y/media-has-caption': 'warn',
44
+ 'jsx-a11y/mouse-events-have-key-events': 'warn',
45
+ 'jsx-a11y/no-access-key': 'warn',
46
+ 'jsx-a11y/no-distracting-elements': 'warn',
47
+ 'jsx-a11y/no-interactive-element-to-noninteractive-role': 'warn',
48
+ 'jsx-a11y/no-noninteractive-element-interactions': 'warn',
49
+ 'jsx-a11y/no-noninteractive-element-to-interactive-role': 'warn',
50
+ 'jsx-a11y/no-noninteractive-tabindex': 'off',
51
+ 'jsx-a11y/no-onchange': 'warn',
52
+ 'jsx-a11y/no-redundant-roles': 'warn',
53
+ 'jsx-a11y/no-static-element-interactions': 'warn',
54
+ 'jsx-a11y/role-has-required-aria-props': 'warn',
55
+ 'jsx-a11y/role-supports-aria-props': 'warn',
56
+ 'jsx-a11y/scope': 'warn',
57
+ 'react/display-name': 'off',
58
+ 'react/forbid-prop-types': 'off',
59
+ 'react/function-component-definition': [
60
+ 'error',
61
+ { namedComponents: 'arrow-function', unnamedComponents: 'arrow-function' },
62
+ ],
63
+ 'react/jsx-no-bind': ['error', { ignoreRefs: true, allowArrowFunctions: true, ignoreDOMComponents: true }],
64
+ 'react/jsx-props-no-spreading': 'off',
65
+ 'react/no-multi-comp': 'off',
66
+ 'react/no-undef': 'off',
67
+ 'react/no-unused-prop-types': 'error',
68
+ 'react/prefer-stateless-function': ['error', { ignorePureComponents: true }],
69
+ 'react-hooks/exhaustive-deps': 'warn',
70
+ },
71
+ },
72
+ {
73
+ files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
74
+ settings: {
75
+ jest: { version: 'detect' },
76
+ },
77
+ extends: ['plugin:jest/recommended', 'plugin:jest-dom/recommended', 'plugin:testing-library/react'],
78
+ plugins: ['jest', 'jest-dom', 'testing-library'],
79
+ rules: {
80
+ 'import/no-extraneous-dependencies': [
81
+ 'error',
82
+ { devDependencies: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'] },
83
+ ],
84
+ 'testing-library/no-render-in-setup': ['error', { allowTestingFrameworkSetupHook: 'beforeEach' }],
85
+ },
86
+ },
87
+ {
88
+ files: ['**/*.ts?(x)'],
89
+ parser: '@typescript-eslint/parser',
90
+ extends: ['plugin:@typescript-eslint/recommended'],
91
+ plugins: ['@typescript-eslint'],
92
+ rules: {
93
+ '@typescript-eslint/ban-types': ['warn', { extendDefaults: true, types: { '{}': false } }],
94
+ '@typescript-eslint/no-empty-interface': 'off',
95
+ '@typescript-eslint/no-use-before-define': ['warn', { functions: false, classes: false, variables: false }],
96
+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
97
+ 'react/jsx-filename-extension': ['warn', { extensions: ['.tsx'] }],
98
+ },
99
+ },
100
+ ],
101
+ rules: {
102
+ 'import/extensions': 'off',
103
+ 'import/order': [
104
+ 'error',
105
+ { groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'] },
106
+ ],
107
+ 'import/prefer-default-export': 'off',
108
+ 'linebreak-style': ['error', 'unix'],
109
+ 'max-len': [
110
+ 'error',
111
+ { code: 120, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true, ignoreRegExpLiterals: true },
112
+ ],
113
+ 'no-await-in-loop': 'warn',
114
+ 'no-console': 'error',
115
+ 'no-constant-condition': ['error', { checkLoops: false }],
116
+ 'no-param-reassign': ['warn', { props: false }],
117
+ 'no-underscore-dangle': 'off',
118
+ 'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
119
+ 'no-use-before-define': 'off',
120
+ 'padding-line-between-statements': ['warn', { blankLine: 'always', prev: '*', next: 'return' }],
121
+ 'prettier/prettier': ['error', { printWidth: 120, singleQuote: true, trailingComma: 'all' }],
122
+ quotes: ['error', 'single', { avoidEscape: true }],
123
+ radix: 'off',
124
+ 'react/no-array-index-key': 'off',
125
+ },
126
+ };
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # eslint-config-badboyku
2
+ Shared eslint+prettier configuration with react/jest/typescript support.
3
+
4
+ ---
5
+
6
+ ### Setup
7
+ 1. Install the package: `yarn add --dev badboyku/eslint-config-badboyku`
8
+
9
+ 2. Create a file named `.eslintrc.js` at the root and add the following:
10
+ ```js
11
+ module.exports = {
12
+ extends: ['badboyku'],
13
+ rules: {},
14
+ };
15
+ ```
16
+
17
+ 3. Add the following to your package.json scripts:
18
+ ```text
19
+ "scripts": {
20
+ "lint": "eslint \"./src/**/*.{js,jsx,ts,tsx}\"",
21
+ "lint:fix": "eslint \"./src/**/*.{js,jsx,ts,tsx}\" --fix",
22
+ "prettier": "prettier --check \"./src/**/*.{css,scss,json}\"",
23
+ "prettier:fix": "prettier --write \"./src/**/*.{css,scss,json}\""
24
+ },
25
+ ```
26
+
27
+ ---
28
+
29
+ ### Configure Rules (optional)
30
+
31
+ If you would like to configure a rule, then you can add to the `rules` object inside the `.eslintrc.js` file (from setup step 2).
32
+
33
+ Example:
34
+ ```text
35
+ rules: {
36
+ 'no-console': 'error',
37
+ },
38
+ ```
39
+
40
+ See https://eslint.org/docs/user-guide/configuring/rules
package/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./.eslintrc.js');
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "eslint-config-badboyku",
3
+ "description": "Shared eslint+prettier configuration with react/jest/typescript support.",
4
+ "version": "1.0.12",
5
+ "author": "badboyku",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/badboyku/eslint-config-badboyku.git"
10
+ },
11
+ "main": "index.js",
12
+ "scripts": {
13
+ "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
14
+ "lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
15
+ "prettier": "prettier --check \"**/*.{css,scss,json}\"",
16
+ "prettier:fix": "prettier --write \"**/*.{css,scss,json}\""
17
+ },
18
+ "prettier": {
19
+ "printWidth": 120,
20
+ "singleQuote": true,
21
+ "trailingComma": "all"
22
+ },
23
+ "dependencies": {
24
+ "@typescript-eslint/eslint-plugin": "^5.10.2",
25
+ "@typescript-eslint/parser": "^5.10.2",
26
+ "eslint": "^8.8.0",
27
+ "eslint-config-airbnb": "^19.0.4",
28
+ "eslint-config-prettier": "^8.3.0",
29
+ "eslint-plugin-import": "^2.25.4",
30
+ "eslint-plugin-jest": "^26.0.0",
31
+ "eslint-plugin-jest-dom": "^4.0.1",
32
+ "eslint-plugin-jsx-a11y": "^6.5.1",
33
+ "eslint-plugin-prettier": "^4.0.0",
34
+ "eslint-plugin-react": "^7.28.0",
35
+ "eslint-plugin-react-hooks": "^4.3.0",
36
+ "eslint-plugin-testing-library": "^5.0.4",
37
+ "prettier": "^2.5.1",
38
+ "typescript": "^4.5.5"
39
+ }
40
+ }