@vertexvis/eslint-config-vertexvis 0.7.2 → 0.8.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/README.md CHANGED
@@ -17,24 +17,12 @@ Add this package and ESLint as `devDependencies` to your `package.json`.
17
17
  }
18
18
  ```
19
19
 
20
- Add a `.eslintrc.js` file to the root of your project that extends this config.
21
-
22
- This package also includes an optional patch file which monkey patches ESLint's
23
- module resolution for plugins. ESLint resolves plugins relative to the consuming
24
- package. So any plugins referenced by a sharable config will need to NPM
25
- installed in the consuming package. There's an [open
26
- issue](https://github.com/eslint/eslint/issues/3458#issuecomment-516716165) and
27
- discussion to change this behavior to resolve plugins relative to the imported
28
- config's `node_modules` folder. This shim mimics this behavior.
20
+ Add an `eslint.config.js` file to the root of your project that imports this
21
+ config.
29
22
 
30
23
  ```js
31
- // .eslintrc.js
32
-
33
- // Include the optional patch which resolves ESLint plugins relative to the
34
- // sharable config package.
35
- require('@vertexvis/eslint-config-vertexvis/patch');
24
+ // eslint.config.js
25
+ import vertexvis from '@vertexvis/eslint-config-vertexvis';
36
26
 
37
- module.exports = {
38
- extends: '@vertexvis/vertexvis',
39
- };
27
+ export default [...vertexvis];
40
28
  ```
package/index.js CHANGED
@@ -1,31 +1,38 @@
1
- module.exports = {
2
- parserOptions: {
3
- ecmaVersion: 6,
1
+ import eslintConfigPrettier from 'eslint-config-prettier';
2
+ import simpleImportSort from 'eslint-plugin-simple-import-sort';
3
+
4
+ export default [
5
+ {
6
+ languageOptions: {
7
+ ecmaVersion: 2019,
8
+ sourceType: 'module',
9
+ },
10
+ plugins: {
11
+ 'simple-import-sort': simpleImportSort,
12
+ },
13
+ rules: {
14
+ eqeqeq: [2, 'smart'],
15
+ 'func-call-spacing': 'off',
16
+ indent: ['error', 2],
17
+ 'lines-between-class-members': [
18
+ 'error',
19
+ 'always',
20
+ { exceptAfterSingleLine: true },
21
+ ],
22
+ 'padding-line-between-statements': [
23
+ 'error',
24
+ { blankLine: 'always', prev: 'function', next: 'function' },
25
+ { blankLine: 'always', prev: 'class', next: 'class' },
26
+ {
27
+ blankLine: 'always',
28
+ prev: 'import',
29
+ next: ['export', 'class', 'function', 'const', 'let', 'var'],
30
+ },
31
+ ],
32
+ 'simple-import-sort/imports': 'error',
33
+ 'simple-import-sort/exports': 'error',
34
+ yoda: 2,
35
+ },
4
36
  },
5
- plugins: ['prettier', 'simple-import-sort'],
6
- extends: ['plugin:prettier/recommended'],
7
- rules: {
8
- eqeqeq: [2, 'smart'],
9
- 'func-call-spacing': 'off',
10
- indent: ['error', 2],
11
- 'lines-between-class-members': [
12
- 'error',
13
- 'always',
14
- { exceptAfterSingleLine: true },
15
- ],
16
- 'padding-line-between-statements': [
17
- 'error',
18
- { blankLine: 'always', prev: 'function', next: 'function' },
19
- { blankLine: 'always', prev: 'class', next: 'class' },
20
- {
21
- blankLine: 'always',
22
- prev: 'import',
23
- next: ['export', 'class', 'function', 'const', 'let', 'var'],
24
- },
25
- ],
26
- 'prettier/prettier': 'error',
27
- 'simple-import-sort/imports': 'error',
28
- 'simple-import-sort/exports': 'error',
29
- yoda: 2,
30
- },
31
- };
37
+ eslintConfigPrettier,
38
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertexvis/eslint-config-vertexvis",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "The Vertex sharable ESLint config",
5
5
  "license": "MIT",
6
6
  "author": "Vertex Developers <support@vertexvis.com> (https://developer.vertexvis.com)",
@@ -16,24 +16,28 @@
16
16
  "registry": "https://registry.npmjs.org/",
17
17
  "access": "public"
18
18
  },
19
+ "type": "module",
19
20
  "main": "./index.js",
21
+ "exports": {
22
+ ".": "./index.js",
23
+ "./package.json": "./package.json"
24
+ },
20
25
  "scripts": {
21
26
  "format": "yarn lint --fix",
22
- "lint": "eslint --ext .ts,.tsx,.js,.jsx --ignore-path ../../.gitignore .",
27
+ "lint": "eslint .",
23
28
  "build": "exit 0",
24
29
  "test": "echo 'No unit tests defined'",
25
30
  "test:coverage": "echo 'No unit tests defined'"
26
31
  },
27
32
  "dependencies": {
28
- "eslint-config-prettier": "^9.0.0",
29
- "eslint-plugin-prettier": "^5.0.0",
30
- "eslint-plugin-simple-import-sort": "^10.0.0",
31
- "prettier": "^3.0.3"
33
+ "eslint-config-prettier": "^10.1.8",
34
+ "eslint-plugin-simple-import-sort": "^13.0.0",
35
+ "prettier": "^3.8.4"
32
36
  },
33
37
  "peerDependencies": {
34
- "eslint": ">=7.0.0"
38
+ "eslint": ">=8.0.0"
35
39
  },
36
40
  "devDependencies": {
37
- "eslint": "^8.6.0"
41
+ "eslint": "^8.57.0"
38
42
  }
39
43
  }
package/.eslintrc.js DELETED
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- extends: './index.js',
3
- };
package/patch.js DELETED
@@ -1,62 +0,0 @@
1
- // This monkey patches eslint to lookup ESLint plugins relative to a sharable
2
- // config's NPM package. This allows a consuming package to use a sharable
3
- // config's plugins without having to add the plugins as NPM dependencies.
4
- //
5
- // To use, require this patch from your .eslintrc.js file.
6
- //
7
- // ```ts
8
- // require('@vertexvis/eslint-config-vertexvis');
9
- //
10
- // module.exports = {
11
- // extends: '@vertexvis/vertexvis'
12
- // };
13
- // ```
14
-
15
- const path = require('path');
16
-
17
- let currentModule = module;
18
- while (
19
- !/[\\/]eslint[\\/]lib[\\/]cli-engine[\\/]config-array-factory\.js/i.test(
20
- currentModule.filename
21
- )
22
- ) {
23
- if (!currentModule.parent) {
24
- // This was tested with ESLint 6.1.0; other versions may not work
25
- throw new Error(
26
- 'Failed to patch ESLint because the calling module was not recognized'
27
- );
28
- }
29
- currentModule = currentModule.parent;
30
- }
31
- const eslintFolder = path.join(path.dirname(currentModule.filename), '../..');
32
-
33
- const configArrayFactoryPath = path.join(
34
- eslintFolder,
35
- 'lib/cli-engine/config-array-factory'
36
- );
37
- const configArrayFactoryModule = require(configArrayFactoryPath);
38
-
39
- const moduleResolverPath = path.join(
40
- eslintFolder,
41
- 'lib/shared/relative-module-resolver'
42
- );
43
- const ModuleResolver = require(moduleResolverPath);
44
-
45
- const originalLoadPlugin =
46
- configArrayFactoryModule.ConfigArrayFactory.prototype._loadPlugin;
47
- configArrayFactoryModule.ConfigArrayFactory.prototype._loadPlugin = function (
48
- name,
49
- importerPath,
50
- importerName
51
- ) {
52
- const originalResolve = ModuleResolver.resolve;
53
- try {
54
- ModuleResolver.resolve = function (moduleName, relativeToPath) {
55
- // resolve using importerPath instead of relativeToPath
56
- return originalResolve.call(this, moduleName, importerPath);
57
- };
58
- return originalLoadPlugin.apply(this, arguments);
59
- } finally {
60
- ModuleResolver.resolve = originalResolve;
61
- }
62
- };