eslint-config-gristow 1.0.37 → 2.0.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.
package/.eslintrc.cjs ADDED
@@ -0,0 +1,36 @@
1
+ const rules = require('./rules/shared-rules.cjs');
2
+ const importRules = require('./rules/import-rules.js');
3
+
4
+ module.exports = {
5
+ root: true,
6
+ extends: [
7
+ 'eslint:recommended',
8
+ 'plugin:@typescript-eslint/recommended',
9
+ 'airbnb/base',
10
+ 'prettier',
11
+ ],
12
+ parser: '@typescript-eslint/parser',
13
+ plugins: ['@typescript-eslint', 'import'],
14
+ // plugins: ['@typescript-eslint'],
15
+ parserOptions: {
16
+ sourceType: 'module',
17
+ ecmaVersion: 2020,
18
+ },
19
+ settings: {
20
+ 'import/parsers': {
21
+ '@typescript-eslint/parser': ['.ts'],
22
+ },
23
+ 'import/resolver': {
24
+ typescript: true,
25
+ },
26
+ },
27
+ rules: {
28
+ ...rules,
29
+ ...importRules
30
+ },
31
+ env: {
32
+ browser: true,
33
+ es2017: true,
34
+ node: true,
35
+ },
36
+ };
@@ -0,0 +1,68 @@
1
+ const rules = require('./shared-rules.js');
2
+
3
+ module.exports = {
4
+ root: true,
5
+ extends: [
6
+ 'eslint:recommended',
7
+ 'plugin:@typescript-eslint/recommended',
8
+ 'prettier',
9
+ 'plugin:svelte/recommended',
10
+ 'plugin:import/recommended',
11
+ ],
12
+ parser: '@typescript-eslint/parser',
13
+ plugins: ['@typescript-eslint', 'import'],
14
+ parserOptions: {
15
+ sourceType: 'module',
16
+ ecmaVersion: 2020,
17
+ extraFileExtensions: ['.svelte'],
18
+ },
19
+ env: {
20
+ browser: true,
21
+ es2017: true,
22
+ node: true,
23
+ },
24
+ settings: {
25
+ 'import/parsers': {
26
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
27
+ },
28
+ 'import/resolver': {
29
+ typescript: {
30
+ alwaysTryTypes: true, // always try to resolve types under `<root>@types` directory even it doesn't contain any source code, like `@types/unist`
31
+ },
32
+ },
33
+ import: {
34
+ parsers: {
35
+ '@typescript-eslint/parser': ['.ts'],
36
+ },
37
+ },
38
+ },
39
+ rules,
40
+ overrides: [
41
+ {
42
+ files: ['*.svelte'],
43
+ parser: 'svelte-eslint-parser',
44
+ parserOptions: {
45
+ parser: '@typescript-eslint/parser',
46
+ extraFileExtensions: ['.svelte'],
47
+ sourceType: 'module',
48
+ ecmaVersion: 2020,
49
+ },
50
+ },
51
+ {
52
+ files: ['*.ts'],
53
+ parser: '@typescript-eslint/parser',
54
+ rules,
55
+ },
56
+ {
57
+ files: ['*.js'],
58
+ rules,
59
+ },
60
+ {
61
+ files: ['*.cjs'],
62
+ rules: {
63
+ '@typescript-eslint/no-var-requires': 'off',
64
+ ...rules,
65
+ },
66
+ },
67
+ ],
68
+ };
@@ -0,0 +1,40 @@
1
+ const sharedRules = require('./shared-rules.cjs');
2
+
3
+ module.exports = {
4
+ root: true,
5
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
6
+ parser: '@typescript-eslint/parser',
7
+ plugins: ['@typescript-eslint', 'import'],
8
+ // plugins: ['@typescript-eslint'],
9
+ parserOptions: {
10
+ sourceType: 'module',
11
+ ecmaVersion: 2020,
12
+ extraFileExtensions: ['.svelte'],
13
+ },
14
+ settings: {
15
+ 'import/parsers': {
16
+ '@typescript-eslint/parser': ['.ts', '.tsx'],
17
+ },
18
+ 'import/resolver': {
19
+ typescript: true,
20
+ },
21
+ },
22
+ rules: {
23
+ 'no-throw-literal': 'error',
24
+ ...sharedRules,
25
+ },
26
+ env: {
27
+ browser: true,
28
+ es2017: true,
29
+ node: true,
30
+ },
31
+ overrides: [
32
+ {
33
+ files: ['*.svelte'],
34
+ parser: 'svelte-eslint-parser',
35
+ parserOptions: {
36
+ parser: '@typescript-eslint/parser',
37
+ },
38
+ },
39
+ ],
40
+ };
@@ -4,7 +4,7 @@ const rules = require('./shared-rules');
4
4
  const prettierRules = require('./prettier-rules');
5
5
 
6
6
  module.exports = {
7
- parser: '@babel/eslint-parser',
7
+ parser: '@typescript-eslint/parser',
8
8
  parserOptions: {
9
9
  ecmaVersion: 2022,
10
10
  project: ['./tsconfig.json'],
@@ -16,13 +16,13 @@ module.exports = {
16
16
  },
17
17
  requireConfigFile: false,
18
18
  },
19
+ rules,
19
20
  overrides: [
20
21
  {
21
22
  files: ['*.js'],
22
23
  plugins: ['prettier', 'jsdoc'],
23
24
  extends: ['airbnb/base', 'prettier'],
24
25
  rules: {
25
- ...rules,
26
26
  ...prettierRules,
27
27
  '@typescript-eslint/indent': 'off',
28
28
  'jsdoc/check-alignment': 1, // Recommended
@@ -51,7 +51,6 @@ module.exports = {
51
51
  parser: '@typescript-eslint/parser',
52
52
  extends: ['airbnb-typescript/base', 'prettier'],
53
53
  rules: {
54
- ...rules,
55
54
  ...prettierRules,
56
55
  '@typescript-eslint/indent': 'off',
57
56
  'import/no-cycle': 'off', // otherwise captures cycles by type inclusion
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "useTabs": false,
3
+ "singleQuote": true,
4
+ "trailingComma": "es5",
5
+ "printWidth": 100,
6
+ "parser": "typescript"
7
+ }
package/index.js CHANGED
@@ -1,3 +1,3 @@
1
- const eslintrc = require('./.eslintrc.js');
1
+ const eslintrc = require('./.eslintrc.cjs');
2
2
 
3
3
  module.exports = eslintrc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-config-gristow",
3
- "version": "1.0.37",
3
+ "version": "2.0.0",
4
4
  "description": "Eslint settings for Greg Ristow",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,66 +10,48 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@babel/core": "^7.14.6",
14
- "@babel/eslint-parser": "^7.14.7",
15
- "@babel/plugin-proposal-class-properties": "^7.4.4",
16
- "@babel/plugin-proposal-decorators": "^7.4.4",
17
- "@babel/plugin-proposal-do-expressions": "^7.2.0",
18
- "@babel/plugin-proposal-export-default-from": "^7.2.0",
19
- "@babel/plugin-proposal-export-namespace-from": "^7.2.0",
20
- "@babel/plugin-proposal-function-sent": "^7.2.0",
21
- "@babel/plugin-proposal-json-strings": "^7.2.0",
22
- "@babel/plugin-proposal-logical-assignment-operators": "^7.2.0",
23
- "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
24
- "@babel/plugin-proposal-numeric-separator": "^7.2.0",
25
- "@babel/plugin-proposal-optional-chaining": "^7.2.0",
26
- "@babel/plugin-proposal-pipeline-operator": "^7.3.2",
27
- "@babel/plugin-proposal-throw-expressions": "^7.2.0",
28
- "@babel/plugin-syntax-dynamic-import": "^7.2.0",
29
- "@babel/plugin-syntax-import-meta": "^7.2.0",
30
- "@babel/plugin-transform-runtime": "^7.5.0",
31
- "@babel/preset-env": "^7.4.5",
32
- "@typescript-eslint/eslint-plugin": "^4.28.2",
33
- "@typescript-eslint/parser": "^4.28.2",
34
- "eslint": "^7.30.0",
35
- "eslint-config-airbnb": "^18.2.1",
36
- "eslint-config-airbnb-typescript": "^12.3.1",
37
- "eslint-config-prettier": "^8.3.0",
38
- "eslint-plugin-html": "^6.1.2",
39
- "eslint-plugin-import": "^2.23.4",
40
- "eslint-plugin-jsdoc": "^35.4.3",
13
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
14
+ "@typescript-eslint/parser": "^5.59.5",
15
+ "eslint": "^8.40.0",
16
+ "eslint-config-airbnb": "^19.0.4",
17
+ "eslint-config-airbnb-typescript": "^17.0.0",
18
+ "eslint-config-prettier": "^8.5.0",
19
+ "eslint-import-resolver-typescript": "^3.5.5",
20
+ "eslint-plugin-html": "^7.1.0",
21
+ "eslint-plugin-import": "^2.27.5",
22
+ "eslint-plugin-jsdoc": "^44.2.3",
41
23
  "eslint-plugin-jsx-a11y": "^6.4.1",
42
- "eslint-plugin-prettier": "^3.4.0",
24
+ "eslint-plugin-prettier": "^4.2.1",
43
25
  "eslint-plugin-react": "^7.24.0",
44
26
  "eslint-plugin-react-hooks": "^4.2.0",
45
27
  "eslint-plugin-svelte": "^2.28.0",
46
28
  "eslint-plugin-tsdoc": "^0.2.14",
47
- "prettier": "^2.3.2"
29
+ "prettier": "^2.8.8"
48
30
  },
49
31
  "peerDependencies": {
50
- "@babel/core": "^7.14.6",
51
- "@babel/eslint-parser": "^7.14.7",
52
- "@typescript-eslint/eslint-plugin": "^4.28.2",
53
- "@typescript-eslint/parser": "^4.28.2",
54
- "eslint": "^7.30.0",
32
+ "@typescript-eslint/eslint-plugin": "^5.59.5",
33
+ "@typescript-eslint/parser": "^5.59.5",
34
+ "eslint": "^8.40.0",
55
35
  "eslint-config-airbnb": "^18.2.1",
56
- "eslint-config-airbnb-typescript": "^12.3.1",
36
+ "eslint-config-airbnb-base": "^15.0.0",
37
+ "eslint-config-airbnb-typescript": "^17.0.0",
57
38
  "eslint-config-prettier": "^8.3.0",
58
- "eslint-plugin-html": "^6.1.1",
59
- "eslint-plugin-import": "^2.23.4",
60
- "eslint-plugin-jsdoc": "^35.4.3",
39
+ "eslint-import-resolver-typescript": "^3.5.5",
40
+ "eslint-plugin-html": "^7.1.0",
41
+ "eslint-plugin-import": "^2.27.5",
42
+ "eslint-plugin-jsdoc": "^44.2.3",
61
43
  "eslint-plugin-jsx-a11y": "^6.4.1",
62
- "eslint-plugin-prettier": "^3.4.0",
44
+ "eslint-plugin-prettier": "^4.2.1",
63
45
  "eslint-plugin-react": "^7.24.0",
64
46
  "eslint-plugin-react-hooks": "^4.2.0",
65
47
  "eslint-plugin-svelte": "^2.28.0",
66
48
  "eslint-plugin-tsdoc": "^0.2.14",
67
- "prettier": "^2.3.2",
68
- "typescript": "*"
49
+ "prettier": "^2.8.6",
50
+ "typescript": "^5.0.4"
69
51
  },
70
52
  "devDependencies": {
71
- "eslint-config-airbnb-base": "^14.2.1",
53
+ "eslint-config-airbnb-base": "^15.0.0",
72
54
  "eslint-plugin-tsdoc": "^0.2.14",
73
- "typescript": ">=4.3.5"
55
+ "typescript": ">=5.0.4"
74
56
  }
75
57
  }
package/readme.md CHANGED
@@ -1,13 +1,12 @@
1
- ### eslint-config-gristow
1
+ # eslint-config-gristow
2
2
 
3
- A basic eslint configuration (loosely based off of eslint-config-wesbos) and extending AirBNB that also wraps in support for *.ts files.
3
+ A somewhat opinonated eslint configuration for js, ts and svelte.
4
4
 
5
5
  npm install --dev eslint-config-gristow
6
6
 
7
7
  ## Local / Per Project Install
8
8
 
9
- 1. If you don't already have a `package.json` file, create one with `npm init`.
10
-
9
+ 1. `yarn add -D eslint-config-gristow`;
11
10
  2. Then we need to install everything needed by the config:
12
11
 
13
12
  ```
@@ -16,19 +15,36 @@ npx install-peerdeps --dev eslint-config-gristow
16
15
 
17
16
  3. You can see in your package.json there are now a big list of devDependencies.
18
17
 
19
- 4. Create a `.eslintrc` file in the root of your project's directory (it should live where package.json does). Your `.eslintrc` file should look like this:
18
+ 4. Create a `.eslintrc` file in the root of your project's directory (it should live where package.json does). Your `.eslintrc.js` file should look like this:
20
19
 
21
- ```json
22
- {
23
- "extends": [
24
- "gristow"
25
- ]
26
- }
20
+ ```js
21
+ module.exports = {
22
+ extends: ['gristow'],
23
+ // This is critical for allowing the import parser to be aware
24
+ // of any paths configured in .tsconfig.json
25
+ settings: {
26
+ 'import/resolver/typescript': {
27
+ project: './tsconfig.json',
28
+ },
29
+ },
30
+ };
27
31
  ```
28
32
 
29
- Tip: You can alternatively put this object in your `package.json` under the property `"eslintConfig":`. This makes one less file in your project.
33
+ 5. If your project uses, svelte, instead extend gristow/svelte:
34
+ ```js
35
+ module.exports = {
36
+ extends: ['gristow/svelte'],
37
+ // This is critical for allowing the import parser to be aware
38
+ // of any paths configured in .tsconfig.json
39
+ settings: {
40
+ 'import/resolver/typescript': {
41
+ project: './tsconfig.json',
42
+ },
43
+ },
44
+ };
45
+ ```
30
46
 
31
- 5. You can add two scripts to your package.json to lint and/or fix:
47
+ 6. You can add two scripts to your package.json to lint and/or fix:
32
48
 
33
49
  ```json
34
50
  "scripts": {
@@ -37,54 +53,44 @@ Tip: You can alternatively put this object in your `package.json` under the prop
37
53
  },
38
54
  ```
39
55
 
40
- 6. Now you can manually lint your code by running `npm run lint` and fix all fixable issues with `npm run lint:fix`. You probably want your editor to do this though.
41
-
42
- ## Settings
43
-
44
- If you'd like to overwrite eslint or prettier settings, you can add the rules in your `.eslintrc` file. The [ESLint rules](https://eslint.org/docs/rules/) go directly under `"rules"` while [prettier options](https://prettier.io/docs/en/options.html) go under `"prettier/prettier"`. Note that prettier rules overwrite anything in my config (trailing comma, and single quote), so you'll need to include those as well.
45
-
46
- ```js
47
- {
48
- "extends": [
49
- "gristow"
50
- ],
51
- "rules": {
52
- "no-console": 2,
53
- "prettier/prettier": [
54
- "error",
55
- {
56
- "trailingComma": "es5",
57
- "singleQuote": true,
58
- "printWidth": 120,
59
- "tabWidth": 8,
60
- }
61
- ]
62
- }
63
- }
64
- ```
56
+ 7. Now you can manually lint your code by running `npm run lint` and fix all fixable issues with `npm run lint:fix`. You probably want your editor to do this though.
65
57
 
66
58
  ## With VS Code
67
59
 
68
-
69
- Once you have the above install, you probably want your editor to lint and fix for you. Here are the instructions for VS Code:
60
+ Once you have the above installed, you probably want your editor to lint and fix for you. Here are the instructions for VS Code:
70
61
 
71
62
  1. Install the [ESLint package](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
63
+
72
64
  2. Now we need to setup some VS Code settings via `Code/File` → `Preferences` → `Settings`. It's easier to enter these settings while editing the `settings.json` file, so click the `{}` icon in the top right corner:
73
65
  ```js
74
- // These are all my auto-save configs
75
- "editor.formatOnSave": true,
76
- // turn it off for JS and JSX, we will do this via eslint
77
66
  "[javascript]": {
78
- "editor.formatOnSave": false
79
- },
67
+ "editor.codeActionsOnSave": {
68
+ "source.fixAll.eslint": true
69
+ }
70
+ },
80
71
  "[typescript]": {
81
- "editor.formatOnSave": false
82
- }
83
- // tell the ESLint plugin to run on save
84
- "editor.codeActionsOnSave": {
85
- "source.fixAll.eslint": true
72
+ "editor.codeActionsOnSave": {
73
+ "source.fixAll.eslint": true
74
+ }
75
+ },
76
+ "[svelte]": {
77
+ "editor.formatOnSave": true,
78
+ "editor.codeActionsOnSave": {
79
+ "source.fixAll.eslint": true
80
+ }
86
81
  },
87
- "eslint.autoFixOnSave": true,
88
82
  // Optional BUT IMPORTANT: If you have the prettier extension enabled for other languages like CSS and HTML, turn it off for JS since we are doing it through Eslint already
89
83
  "prettier.disableLanguages": ["javascript", "javascriptreact", "typescript"],
90
84
  ```
85
+
86
+ 3. If you have svelte files you are linting, we have to tell the VS Code eslint extension to parse those in `settings.json`:
87
+
88
+ ```json
89
+ {
90
+ "eslint.validate": [
91
+ "javascript",
92
+ "typescript",
93
+ "svelte"
94
+ ]
95
+ }
96
+ ```
@@ -0,0 +1,56 @@
1
+ module.exports = {
2
+ 'import/no-deprecated': 'warn',
3
+ 'import/export': 'error',
4
+ 'import/no-empty-named-blocks': 'error',
5
+ 'import/order': [
6
+ 'warn',
7
+ {
8
+ groups: ['builtin', 'external', 'internal', 'parent', 'sibling', 'index', 'object', 'type'],
9
+ },
10
+ ],
11
+ 'import/newline-after-import': 'warn',
12
+
13
+ // From here on we just disable the ones airbnb enabled:
14
+ 'import/prefer-default-import': 'off',
15
+ // Typescript does this for us!
16
+ 'import/no-unresolved': 'off',
17
+ 'import/named': 'off',
18
+ 'import/default': 'off',
19
+ 'import/namespace': 'off',
20
+ 'import/no-named-as-default': 'off',
21
+ 'import/no-named-as-default-member': 'off',
22
+ 'import/no-extraneous-dependencies': 'off',
23
+ 'import/no-mutable-exports': 'off',
24
+ 'import/no-commonjs': 'off',
25
+ 'import/no-amd': 'off',
26
+ 'import/no-nodejs-modules': 'off',
27
+ 'import/first': 'off',
28
+ 'import/imports-first': 'off',
29
+ 'import/no-duplicates': 'off',
30
+ 'import/no-namespace': 'off',
31
+ 'import/extensions': 'off',
32
+ 'import/prefer-default-export': 'off',
33
+ 'import/no-restricted-paths': 'off',
34
+ 'import/max-dependencies': 'off',
35
+ 'import/no-absolute-path': 'off',
36
+ 'import/no-dynamic-require': 'off',
37
+ 'import/no-internal-modules': 'off',
38
+ 'import/unambiguous': 'off',
39
+ 'import/no-webpack-loader-syntax': 'off',
40
+ 'import/no-unassigned-import': 'off',
41
+ 'import/no-named-default': 'off',
42
+ 'import/no-anonymous-default-export': 'off',
43
+ 'import/exports-last': 'off',
44
+ 'import/group-exports': 'off',
45
+ 'import/no-default-export': 'off',
46
+ 'import/no-named-export': 'off',
47
+ 'import/no-self-import': 'off',
48
+ 'import/no-cycle': 'off',
49
+ 'import/no-useless-path-segments': 'off',
50
+ 'import/dynamic-import-chunkname': 'off',
51
+ 'import/no-relative-parent-imports': 'off',
52
+ 'import/no-unused-modules': 'off',
53
+ 'import/no-import-module-exports': 'off',
54
+ 'import/no-relative-packages': 'off',
55
+ 'import/consistent-type-specifier-style': 'off',
56
+ };
@@ -2,11 +2,13 @@
2
2
  * These rules are shared by both .js and .ts
3
3
  */
4
4
  module.exports = {
5
+ 'no-unused-vars': 'error',
6
+ 'no-unreachable': 'error',
5
7
  'no-use-before-define': ['error', { functions: false }],
6
- '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
8
+ // '@-define': ['error', { functions: false }],
7
9
  'no-duplicate-imports': 'error',
8
- 'no-debugger': 0,
9
- 'no-restricted-syntax': [2, 'LabeledStatement', 'WithStatement'],
10
+ 'no-debugger': 'off',
11
+ 'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'],
10
12
  'prefer-arrow-callback': 'off',
11
13
  'prefer-const': [
12
14
  'error',
@@ -14,17 +16,16 @@ module.exports = {
14
16
  destructuring: 'all',
15
17
  },
16
18
  ],
17
- 'arrow-body-style': [2, 'as-needed'],
18
- 'import/extensions': 0,
19
+ 'arrow-body-style': ['error', 'as-needed'],
19
20
  'no-shadow': [
20
- 2,
21
+ 'error',
21
22
  {
22
23
  hoist: 'all',
23
24
  allow: ['resolve', 'reject', 'done', 'next', 'err', 'error'],
24
25
  },
25
26
  ],
26
27
  quotes: [
27
- 2,
28
+ 'error',
28
29
  'single',
29
30
  {
30
31
  avoidEscape: true,
@@ -32,12 +33,14 @@ module.exports = {
32
33
  },
33
34
  ],
34
35
  'func-names': ['error', 'as-needed'],
35
- 'prefer-destructuring': 0,
36
- 'prefer-promise-reject-errors': 0,
36
+ 'prefer-destructuring': 'off',
37
+ 'prefer-promise-reject-errors': 'off',
37
38
  'wrap-iife': 'off',
38
39
  'no-else-return': 'warn',
39
- 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
40
- 'import/prefer-default-export': 'off',
40
+ '@typescript-eslint/consistent-type-imports': [
41
+ 'error',
42
+ { prefer: 'type-imports', fixStyle: 'separate-type-imports' },
43
+ ],
41
44
  'prefer-template': 'warn',
42
45
  'no-plusplus': 'off',
43
46
  'no-confusing-arrow': 'off',
@@ -54,4 +57,12 @@ module.exports = {
54
57
  'no-mixed-operators': 'off',
55
58
  'no-lonely-if': 'warn',
56
59
  'guard-for-in': 'warn',
60
+ '@typescript-eslint/no-var-requires': 'warn',
61
+ 'no-dupe-class-members': 'off',
62
+ // So we can allow overloading, and list of class props defined
63
+ 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
64
+ 'no-redeclare': 'off',
65
+ '@typescript-eslint/no-redeclare': 'error',
66
+ // Enabled by airbnb -- but we use literal throws extensively, and intentionally, in /backend
67
+ 'no-throw-literal': 'off',
57
68
  };
@@ -0,0 +1,13 @@
1
+ module.exports = {
2
+ // Must disable to make 2-way data binding possible
3
+ 'import/no-mutable-exports': 'off',
4
+ 'import/no-extraneous-dependencies': ['error', { devDependencies: true }],
5
+ 'no-labels': 'off',
6
+ 'no-restricted-syntax': 'off',
7
+ // In svelte we often have to init an export ot undefined to mark it as an optional
8
+ // property:
9
+ 'no-undef-init': 'off',
10
+ // Svelte checking will handle verifying resolved imports, and eslint is unfortunately
11
+ // unaware of vite paths:
12
+ 'import/no-unresolved': 'off',
13
+ };
@@ -0,0 +1,28 @@
1
+ const svelteRules = require('../rules/svelte-rules.cjs');
2
+
3
+ module.exports = {
4
+ extends: ['gristow', 'plugin:svelte/recommended'],
5
+ parserOptions: {
6
+ sourceType: 'module',
7
+ ecmaVersion: 2020,
8
+ extraFileExtensions: ['.svelte'],
9
+ },
10
+ settings: {
11
+ 'import/parsers': {
12
+ '@typescript-eslint/parser': ['.ts', '.svelte'],
13
+ },
14
+ 'import/resolver': {
15
+ typescript: true,
16
+ },
17
+ },
18
+ overrides: [
19
+ {
20
+ files: ['*.svelte'],
21
+ parser: 'svelte-eslint-parser',
22
+ parserOptions: {
23
+ parser: '@typescript-eslint/parser',
24
+ },
25
+ rules: svelteRules,
26
+ },
27
+ ],
28
+ };
package/svelte.js ADDED
@@ -0,0 +1,3 @@
1
+ const eslintrc = require('./svelte/svelte.eslintrc.cjs');
2
+
3
+ module.exports = eslintrc;
package/test.ts CHANGED
@@ -24,3 +24,5 @@ setTimeout(function isNotAnArrowFunction() {
24
24
  function addOne(n) {
25
25
  return n + 1;
26
26
  }
27
+
28
+ throw 'hello';
package/prettier-rules.js DELETED
@@ -1,11 +0,0 @@
1
- module.exports = {
2
- 'prettier/prettier': [
3
- 'error',
4
- {
5
- trailingComma: 'es5',
6
- singleQuote: true,
7
- printWidth: 100,
8
- tabWidth: 2,
9
- },
10
- ],
11
- };
@@ -1,59 +0,0 @@
1
- // See https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/ROADMAP.md for tslint-eslint rule migration
2
-
3
- const rules = require('./shared-rules');
4
- const prettierRules = require('./prettier-rules');
5
-
6
- module.exports = {
7
- parser: '@babel/eslint-parser',
8
- parserOptions: {
9
- ecmaVersion: 2022,
10
- project: ['./tsconfig.json'],
11
- allowAutomaticSingleRunInference: true,
12
- // Can I remove these now?
13
- ecmaFeatures: {
14
- impliedStrict: true,
15
- classes: true,
16
- },
17
- requireConfigFile: false,
18
- },
19
- extends: ['plugin:svelte/recommended', './.eslintrc.js'],
20
- overrides: [
21
- {
22
- files: ['*.svelte'],
23
- plugins: ['@typescript-eslint', 'eslint-plugin-tsdoc'],
24
- extends: ['airbnb-typescript/base'],
25
- rules: {
26
- ...rules,
27
- /**
28
- * eslint-plugin-svelte3 has issues, basically, with any eslint fix that creates a
29
- * multi-line fix. So, lots has to be disabled... even so, I'm sure I've missed some
30
- * see https://github.com/sveltejs/eslint-plugin-svelte3/blob/master/OTHER_PLUGINS.md
31
- */
32
- 'import/first': 'off',
33
- 'import/no-cycle': 'off',
34
- 'import/no-duplicates': 'off',
35
- 'import/no-mutable-exports': 'off',
36
- 'import/no-unresolved': 'off',
37
- 'import/no-useless-path-segments': 'off',
38
- // Prettier will add an empty line before end of </script> so this has to be off.
39
- 'no-multiple-empty-lines': 'off',
40
- // Prettier will sometimes add a new line after =, so disable this:
41
- 'operator-linebreak': 'off',
42
- '@typescript-eslint/indent': 'off',
43
- '@typescript-eslint/no-var-requires': 'warn',
44
- '@typescript-eslint/no-use-before-define': ['error', { functions: false }],
45
- 'no-useless-constructor': 'off',
46
- // no-dupe-class-members should be removed when this PR lands:
47
- // https://github.com/typescript-eslint/typescript-eslint/pull/1492
48
- 'no-dupe-class-members': 'off',
49
- // So we can allow overloading, and list of class props defined
50
- 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: true }],
51
- '@typescript-eslint/no-useless-constructor': 'error',
52
- 'tsdoc/syntax': 'warn',
53
- // We get these via TS checking, and w/ import type we might have 2 entries,
54
- // one for named, one for default, one for actual import.
55
- 'no-duplicate-imports': 'off',
56
- },
57
- },
58
- ],
59
- };