@modern-js/plugin 1.3.2 → 1.3.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.
Files changed (39) hide show
  1. package/.eslintrc.js +8 -0
  2. package/CHANGELOG.md +9 -0
  3. package/dist/js/modern/manager/sync.js +1 -2
  4. package/dist/js/modern/waterfall/async.js +3 -5
  5. package/dist/js/modern/waterfall/sync.js +3 -5
  6. package/dist/js/modern/workflow/async.js +0 -3
  7. package/dist/js/modern/workflow/parallel.js +1 -2
  8. package/dist/js/node/manager/sync.js +1 -2
  9. package/dist/js/node/waterfall/async.js +3 -5
  10. package/dist/js/node/waterfall/sync.js +3 -5
  11. package/dist/js/node/workflow/async.js +0 -3
  12. package/dist/js/node/workflow/parallel.js +1 -2
  13. package/dist/js/treeshaking/manager/sync.js +1 -2
  14. package/dist/js/treeshaking/waterfall/async.js +7 -10
  15. package/dist/js/treeshaking/waterfall/sync.js +7 -10
  16. package/dist/js/treeshaking/workflow/async.js +0 -2
  17. package/dist/js/treeshaking/workflow/parallel.js +1 -2
  18. package/jest.config.js +0 -1
  19. package/package.json +1 -1
  20. package/tests/.eslintrc.js +0 -6
  21. package/tests/async.test.ts +0 -738
  22. package/tests/fixtures/async/base/bar.ts +0 -22
  23. package/tests/fixtures/async/base/foo.ts +0 -20
  24. package/tests/fixtures/async/base/fooManager.ts +0 -47
  25. package/tests/fixtures/async/core/index.ts +0 -174
  26. package/tests/fixtures/async/dynamic/bar.ts +0 -18
  27. package/tests/fixtures/async/dynamic/foo.ts +0 -27
  28. package/tests/fixtures/sync/base/bar.ts +0 -21
  29. package/tests/fixtures/sync/base/foo.ts +0 -20
  30. package/tests/fixtures/sync/base/fooManager.ts +0 -47
  31. package/tests/fixtures/sync/core/index.ts +0 -171
  32. package/tests/fixtures/sync/dynamic/bar.ts +0 -22
  33. package/tests/fixtures/sync/dynamic/foo.ts +0 -27
  34. package/tests/helpers.ts +0 -4
  35. package/tests/pipeline.test.ts +0 -607
  36. package/tests/sync.test.ts +0 -701
  37. package/tests/tsconfig.json +0 -13
  38. package/tests/waterfall.test.ts +0 -172
  39. package/tests/workflow.test.ts +0 -111
package/.eslintrc.js ADDED
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: ['@modern-js'],
4
+ parserOptions: {
5
+ tsconfigRootDir: __dirname,
6
+ project: ['./tsconfig.json'],
7
+ },
8
+ };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @modern-js/plugin
2
2
 
3
+ ## 1.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 6cffe99d: chore:
8
+ remove react eslint rules for `modern-js` rule set.
9
+ add .eslintrc for each package to speed up linting
10
+ - 60f7d8bf: feat: add tests dir to npmignore
11
+
3
12
  ## 1.3.2
4
13
 
5
14
  ### Patch Changes
@@ -173,8 +173,7 @@ export const cloneHook = hook => {
173
173
 
174
174
  if (isPipeline(hook)) {
175
175
  return createPipeline();
176
- } // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
177
-
176
+ }
178
177
 
179
178
  throw new Error(`Unknown hook: ${hook}`);
180
179
  };
@@ -11,7 +11,7 @@ export const getAsyncBrook = input => {
11
11
  return input;
12
12
  } else if (input && typeof input.middleware === 'function') {
13
13
  return input.middleware;
14
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
14
+ } // eslint-disable-next-line @typescript-eslint/no-base-to-string
15
15
 
16
16
 
17
17
  throw new Error(`${input} is not a AsyncBrook or { brook: AsyncBrook }`);
@@ -24,15 +24,13 @@ export const createAsyncWaterfall = () => {
24
24
  return waterfall;
25
25
  };
26
26
 
27
- const run = (input, options) => // eslint-disable-next-line @typescript-eslint/no-shadow
28
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
27
+ const run = (input, options) => pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
29
28
  onLast: input => input
30
29
  }));
31
30
 
32
31
  const middleware = input => {
33
32
  // eslint-disable-next-line react-hooks/rules-of-hooks
34
- const container = useContainer(); // eslint-disable-next-line @typescript-eslint/no-shadow
35
-
33
+ const container = useContainer();
36
34
  return pipeline.run(input, {
37
35
  container,
38
36
  onLast: input => input
@@ -11,7 +11,7 @@ export const getBrook = input => {
11
11
  return input;
12
12
  } else if (input && typeof input.middleware === 'function') {
13
13
  return input.middleware;
14
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
14
+ } // eslint-disable-next-line @typescript-eslint/no-base-to-string
15
15
 
16
16
 
17
17
  throw new Error(`${input} is not a Brook or { brook: Brook }`);
@@ -24,15 +24,13 @@ export const createWaterfall = () => {
24
24
  return waterfall;
25
25
  };
26
26
 
27
- const run = (input, options) => // eslint-disable-next-line @typescript-eslint/no-shadow
28
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
27
+ const run = (input, options) => pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
29
28
  onLast: input => input
30
29
  }));
31
30
 
32
31
  const middleware = input => {
33
32
  // eslint-disable-next-line react-hooks/rules-of-hooks
34
- const container = useContainer(); // eslint-disable-next-line @typescript-eslint/no-shadow
35
-
33
+ const container = useContainer();
36
34
  return pipeline.run(input, {
37
35
  container,
38
36
  onLast: input => input
@@ -21,7 +21,6 @@ export const createAsyncWorkflow = () => {
21
21
  }));
22
22
 
23
23
  if (isPromise(result)) {
24
- // eslint-disable-next-line @typescript-eslint/no-shadow,promise/prefer-await-to-then
25
24
  return result.then(result => result.filter(Boolean));
26
25
  } else {
27
26
  return result.filter(Boolean);
@@ -40,7 +39,5 @@ export const createAsyncWorkflow = () => {
40
39
  const mapAsyncWorkerToAsyncMiddleware = worker => async (input, next) => [await worker(input), ...(await next(input))];
41
40
 
42
41
  function isPromise(obj) {
43
- /* eslint-disable promise/prefer-await-to-then */
44
42
  return Boolean(obj) && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
45
- /* eslint-enable promise/prefer-await-to-then */
46
43
  }
@@ -15,8 +15,7 @@ export const createParallelWorkflow = () => {
15
15
  return workflow;
16
16
  };
17
17
 
18
- const run = async (input, options) => // eslint-disable-next-line promise/prefer-await-to-then
19
- Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
18
+ const run = async (input, options) => Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
20
19
  onLast: () => []
21
20
  }))).then(result => result.filter(Boolean));
22
21
 
@@ -192,8 +192,7 @@ const cloneHook = hook => {
192
192
 
193
193
  if ((0, _farrowPipeline.isPipeline)(hook)) {
194
194
  return (0, _farrowPipeline.createPipeline)();
195
- } // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
196
-
195
+ }
197
196
 
198
197
  throw new Error(`Unknown hook: ${hook}`);
199
198
  };
@@ -20,7 +20,7 @@ const getAsyncBrook = input => {
20
20
  return input;
21
21
  } else if (input && typeof input.middleware === 'function') {
22
22
  return input.middleware;
23
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
23
+ } // eslint-disable-next-line @typescript-eslint/no-base-to-string
24
24
 
25
25
 
26
26
  throw new Error(`${input} is not a AsyncBrook or { brook: AsyncBrook }`);
@@ -36,15 +36,13 @@ const createAsyncWaterfall = () => {
36
36
  return waterfall;
37
37
  };
38
38
 
39
- const run = (input, options) => // eslint-disable-next-line @typescript-eslint/no-shadow
40
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
39
+ const run = (input, options) => pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
41
40
  onLast: input => input
42
41
  }));
43
42
 
44
43
  const middleware = input => {
45
44
  // eslint-disable-next-line react-hooks/rules-of-hooks
46
- const container = (0, _farrowPipeline.useContainer)(); // eslint-disable-next-line @typescript-eslint/no-shadow
47
-
45
+ const container = (0, _farrowPipeline.useContainer)();
48
46
  return pipeline.run(input, {
49
47
  container,
50
48
  onLast: input => input
@@ -20,7 +20,7 @@ const getBrook = input => {
20
20
  return input;
21
21
  } else if (input && typeof input.middleware === 'function') {
22
22
  return input.middleware;
23
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
23
+ } // eslint-disable-next-line @typescript-eslint/no-base-to-string
24
24
 
25
25
 
26
26
  throw new Error(`${input} is not a Brook or { brook: Brook }`);
@@ -36,15 +36,13 @@ const createWaterfall = () => {
36
36
  return waterfall;
37
37
  };
38
38
 
39
- const run = (input, options) => // eslint-disable-next-line @typescript-eslint/no-shadow
40
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
39
+ const run = (input, options) => pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
41
40
  onLast: input => input
42
41
  }));
43
42
 
44
43
  const middleware = input => {
45
44
  // eslint-disable-next-line react-hooks/rules-of-hooks
46
- const container = (0, _farrowPipeline.useContainer)(); // eslint-disable-next-line @typescript-eslint/no-shadow
47
-
45
+ const container = (0, _farrowPipeline.useContainer)();
48
46
  return pipeline.run(input, {
49
47
  container,
50
48
  onLast: input => input
@@ -33,7 +33,6 @@ const createAsyncWorkflow = () => {
33
33
  }));
34
34
 
35
35
  if (isPromise(result)) {
36
- // eslint-disable-next-line @typescript-eslint/no-shadow,promise/prefer-await-to-then
37
36
  return result.then(result => result.filter(Boolean));
38
37
  } else {
39
38
  return result.filter(Boolean);
@@ -54,7 +53,5 @@ exports.createAsyncWorkflow = createAsyncWorkflow;
54
53
  const mapAsyncWorkerToAsyncMiddleware = worker => async (input, next) => [await worker(input), ...(await next(input))];
55
54
 
56
55
  function isPromise(obj) {
57
- /* eslint-disable promise/prefer-await-to-then */
58
56
  return Boolean(obj) && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
59
- /* eslint-enable promise/prefer-await-to-then */
60
57
  }
@@ -27,8 +27,7 @@ const createParallelWorkflow = () => {
27
27
  return workflow;
28
28
  };
29
29
 
30
- const run = async (input, options) => // eslint-disable-next-line promise/prefer-await-to-then
31
- Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
30
+ const run = async (input, options) => Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
32
31
  onLast: () => []
33
32
  }))).then(result => result.filter(Boolean));
34
33
 
@@ -221,8 +221,7 @@ export var cloneHook = function cloneHook(hook) {
221
221
 
222
222
  if (isPipeline(hook)) {
223
223
  return createPipeline();
224
- } // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
225
-
224
+ }
226
225
 
227
226
  throw new Error("Unknown hook: ".concat(hook));
228
227
  };
@@ -29,7 +29,7 @@ export var getAsyncBrook = function getAsyncBrook(input) {
29
29
  return input;
30
30
  } else if (input && typeof input.middleware === 'function') {
31
31
  return input.middleware;
32
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
32
+ } // eslint-disable-next-line @typescript-eslint/no-base-to-string
33
33
 
34
34
 
35
35
  throw new Error("".concat(input, " is not a AsyncBrook or { brook: AsyncBrook }"));
@@ -47,19 +47,16 @@ export var createAsyncWaterfall = function createAsyncWaterfall() {
47
47
  };
48
48
 
49
49
  var run = function run(input, options) {
50
- return (// eslint-disable-next-line @typescript-eslint/no-shadow
51
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
52
- onLast: function onLast(input) {
53
- return input;
54
- }
55
- }))
56
- );
50
+ return pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
51
+ onLast: function onLast(input) {
52
+ return input;
53
+ }
54
+ }));
57
55
  };
58
56
 
59
57
  var middleware = function middleware(input) {
60
58
  // eslint-disable-next-line react-hooks/rules-of-hooks
61
- var container = useContainer(); // eslint-disable-next-line @typescript-eslint/no-shadow
62
-
59
+ var container = useContainer();
63
60
  return pipeline.run(input, {
64
61
  container: container,
65
62
  onLast: function onLast(input) {
@@ -23,7 +23,7 @@ export var getBrook = function getBrook(input) {
23
23
  return input;
24
24
  } else if (input && typeof input.middleware === 'function') {
25
25
  return input.middleware;
26
- } // eslint-disable-next-line @typescript-eslint/no-base-to-string,@typescript-eslint/restrict-template-expressions
26
+ } // eslint-disable-next-line @typescript-eslint/no-base-to-string
27
27
 
28
28
 
29
29
  throw new Error("".concat(input, " is not a Brook or { brook: Brook }"));
@@ -41,19 +41,16 @@ export var createWaterfall = function createWaterfall() {
41
41
  };
42
42
 
43
43
  var run = function run(input, options) {
44
- return (// eslint-disable-next-line @typescript-eslint/no-shadow
45
- pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
46
- onLast: function onLast(input) {
47
- return input;
48
- }
49
- }))
50
- );
44
+ return pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
45
+ onLast: function onLast(input) {
46
+ return input;
47
+ }
48
+ }));
51
49
  };
52
50
 
53
51
  var middleware = function middleware(input) {
54
52
  // eslint-disable-next-line react-hooks/rules-of-hooks
55
- var container = useContainer(); // eslint-disable-next-line @typescript-eslint/no-shadow
56
-
53
+ var container = useContainer();
57
54
  return pipeline.run(input, {
58
55
  container: container,
59
56
  onLast: function onLast(input) {
@@ -124,7 +124,5 @@ var mapAsyncWorkerToAsyncMiddleware = function mapAsyncWorkerToAsyncMiddleware(w
124
124
  };
125
125
 
126
126
  function isPromise(obj) {
127
- /* eslint-disable promise/prefer-await-to-then */
128
127
  return Boolean(obj) && (_typeof(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
129
- /* eslint-enable promise/prefer-await-to-then */
130
128
  }
@@ -45,8 +45,7 @@ export var createParallelWorkflow = function createParallelWorkflow() {
45
45
  while (1) {
46
46
  switch (_context.prev = _context.next) {
47
47
  case 0:
48
- return _context.abrupt("return", // eslint-disable-next-line promise/prefer-await-to-then
49
- Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
48
+ return _context.abrupt("return", Promise.all(pipeline.run(input, _objectSpread(_objectSpread({}, options), {}, {
50
49
  onLast: function onLast() {
51
50
  return [];
52
51
  }
package/jest.config.js CHANGED
@@ -2,7 +2,6 @@ const sharedConfig = require('@scripts/jest-config');
2
2
 
3
3
  /** @type {import('@jest/types').Config.InitialOptions} */
4
4
  module.exports = {
5
- // eslint-disable-next-line node/no-unsupported-features/es-syntax
6
5
  ...sharedConfig,
7
6
  rootDir: __dirname,
8
7
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "1.3.2",
14
+ "version": "1.3.3",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./dist/types/index.d.ts",
17
17
  "main": "./dist/js/node/index.js",
@@ -1,6 +0,0 @@
1
- module.exports = {
2
- extends: ['@modern-js'],
3
- parserOptions: {
4
- project: require.resolve('./tsconfig.json'),
5
- },
6
- };