@etchteam/eslint-config 0.0.1 → 1.0.3

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.
File without changes
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ ## [1.0.3](https://github.com/etchteam/eslint/compare/v1.0.2...v1.0.3) (2022-12-19)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add peer deps ([641e7be](https://github.com/etchteam/eslint/commit/641e7be83810b4c8946bb421b1b2950937a1ad5e))
7
+ * eslint requires a specific config name ([0bffcee](https://github.com/etchteam/eslint/commit/0bffcee865455d339b296da15875d851d2e45ea7))
8
+ * keep config in single file ([8d707e2](https://github.com/etchteam/eslint/commit/8d707e220929861f31795497447366a7bb2f92a5))
package/README.md CHANGED
@@ -5,11 +5,70 @@ The eslint config that we use at [Etch](https://etch.co)
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm install eslint @etchteam/eslint
8
+ npm install eslint prettier @etchteam/eslint-config
9
9
  ```
10
10
 
11
- ## Use
11
+ ## Usage
12
12
 
13
13
  ```bash
14
- echo "module.exports = { extends: ['@etchteam/eslint'] }" > .eslintrc.js
14
+ echo "module.exports = { extends: ['@etchteam'] }" > .eslintrc.js
15
+ ```
16
+
17
+ ### With lint-staged
18
+
19
+ #### New project
20
+
21
+ Run the following:
22
+
23
+ ```bash
24
+ npm install husky lint-staged
25
+
26
+ echo "module.exports = { '*.{ts,tsx,js,jsx}': 'eslint --fix' };" > lint-staged.config.js
27
+
28
+ npx husky install
29
+
30
+ npx husky set .husky/pre-commit "npx --no-install -- lint-staged"
31
+
32
+ ```
33
+
34
+ #### Existing project with husky and lint staged
35
+
36
+ Add the following to your lint-staged config:
37
+
38
+ `'*.{ts,tsx,js,jsx}': 'eslint --fix'`
39
+
40
+ ## Usage with VSCode
41
+
42
+ ### New project with no VSCode config
43
+
44
+ Run the following:
45
+
46
+ ```bash
47
+ mkdir .vscode
48
+
49
+ echo "{ "editor.formatOnSave": false, "editor.codeActionsOnSave": { "source.fixAll.eslint": true } }" > .vscode/settings.json
50
+
51
+ # The VSCode prettier extension doesn't read the eslint config, so specific
52
+ # prettier overrides need to go in a prettier config for format on save
53
+ echo "module.exports = { singleQuote: true };" > prettier.config.js
54
+
55
+ ```
56
+
57
+ ### Exisiting project with VSCode config
58
+
59
+ Add the following to `.vscode/settings.json`:
60
+
61
+ ```json
62
+ "editor.formatOnSave": false,
63
+ "editor.codeActionsOnSave": {
64
+ "source.fixAll.eslint": true
65
+ }
66
+ ```
67
+
68
+ Run the following:
69
+
70
+ ```bash
71
+ # The VSCode prettier extension doesn't read the eslint config, so specific
72
+ # prettier overrides need to go in a prettier config for format on save
73
+ echo "module.exports = { singleQuote: true };" > prettier.config.js
15
74
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etchteam/eslint-config",
3
- "version": "0.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Etch's standard eslint config",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -30,6 +30,8 @@
30
30
  "lint-staged": "^13.1.0"
31
31
  },
32
32
  "dependencies": {
33
+ "@typescript-eslint/eslint-plugin": "^5.46.1",
34
+ "@typescript-eslint/parser": "^5.46.1",
33
35
  "eslint": "^8.29.0",
34
36
  "eslint-config-next": "^13.0.7",
35
37
  "eslint-config-prettier": "^8.5.0",
@@ -39,5 +41,9 @@
39
41
  "eslint-plugin-storybook": "^0.6.8",
40
42
  "eslint-plugin-unused-imports": "^2.0.0",
41
43
  "prettier": "^2.8.1"
44
+ },
45
+ "peerDependencies": {
46
+ "eslint": "^8.29.0",
47
+ "prettier": "^2.8.1"
42
48
  }
43
49
  }
package/src/index.js CHANGED
@@ -1,3 +1,34 @@
1
- import config from './.eslintrc.js';
2
-
3
- export default config;
1
+ module.exports = {
2
+ extends: [
3
+ 'next/core-web-vitals',
4
+ 'plugin:@typescript-eslint/recommended',
5
+ 'plugin:storybook/recommended',
6
+ 'plugin:security/recommended',
7
+ 'plugin:import/recommended',
8
+ 'plugin:import/typescript',
9
+ 'plugin:prettier/recommended',
10
+ ],
11
+ plugins: ['unused-imports'],
12
+ parser: '@typescript-eslint/parser',
13
+ rules: {
14
+ 'no-unused-vars': 'off',
15
+ '@typescript-eslint/no-unused-vars': 'error',
16
+ 'unused-imports/no-unused-imports': 'error',
17
+ 'unused-imports/no-unused-vars': 'off',
18
+ 'import/order': ['error', {
19
+ 'newlines-between': 'always',
20
+ alphabetize: {
21
+ order: 'asc'
22
+ },
23
+ }],
24
+ },
25
+ settings: {
26
+ 'import/resolver': {
27
+ typescript: true,
28
+ node: true
29
+ },
30
+ 'prettier/prettier': {
31
+ singleQuote: true,
32
+ },
33
+ }
34
+ };