@bigbinary/eslint-plugin-neeto 1.4.0 → 1.5.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/dist/index.js CHANGED
@@ -2094,6 +2094,15 @@
2094
2094
 
2095
2095
  var _require = require("prettier"),
2096
2096
  resolveConfig = _require.resolveConfig;
2097
+ var getPrettierConfig = function getPrettierConfig(fileName) {
2098
+ var options = {
2099
+ useCache: true,
2100
+ editorconfig: true
2101
+ };
2102
+ if (resolveConfig.sync) return resolveConfig.sync(fileName, options);
2103
+ var resolveConfigSync = require("synckit").createSyncFn(require.resolve("./resolveConfigWorker.js"));
2104
+ return resolveConfigSync(fileName, options);
2105
+ };
2097
2106
  var ensureCompactObjects = {
2098
2107
  meta: {
2099
2108
  type: "problem",
@@ -2104,9 +2113,9 @@
2104
2113
  fixable: "whitespace"
2105
2114
  },
2106
2115
  create: function create(context) {
2116
+ var prettierConfig = getPrettierConfig(context.getFilename());
2107
2117
  return {
2108
2118
  ObjectExpression: function ObjectExpression(node) {
2109
- var _resolveConfig$sync;
2110
2119
  if (isExcludedFile(EXCLUDED_FILES, context.getFilename())) return;
2111
2120
  if (!neetoCist.matches(OBJECT_EXPRESSION_PATTERN$1, node)) return;
2112
2121
  var sourceCode = context.getSourceCode();
@@ -2122,10 +2131,7 @@
2122
2131
  if (/\r|\n/.test(_fix)) return;
2123
2132
  var openingBraceColumn = node.loc.start.column;
2124
2133
  var closingBraceColumn = node.loc.end.column;
2125
- var printWidth = ((_resolveConfig$sync = resolveConfig.sync(context.getFilename(), {
2126
- useCache: true,
2127
- editorconfig: true
2128
- })) === null || _resolveConfig$sync === void 0 ? void 0 : _resolveConfig$sync.printWidth) || 80;
2134
+ var printWidth = (prettierConfig === null || prettierConfig === void 0 ? void 0 : prettierConfig.printWidth) || 80;
2129
2135
  var countOfTokensAfterClosingBrace = sourceCode.lines[closingBraceLine - 1].slice(closingBraceColumn).length;
2130
2136
  var resultLength = openingBraceColumn + _fix.length + countOfTokensAfterClosingBrace;
2131
2137
  if (resultLength > printWidth - 10) return;
@@ -0,0 +1,8 @@
1
+ const { runAsWorker } = require("synckit");
2
+
3
+ runAsWorker(async (path, options) => {
4
+ const prettier = await import("prettier");
5
+ const config = await prettier.resolveConfig(path, options);
6
+
7
+ return config;
8
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/eslint-plugin-neeto",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "main": "dist/index.js",
5
5
  "license": "UNLICENSED",
6
6
  "scripts": {
@@ -18,7 +18,8 @@
18
18
  ]
19
19
  },
20
20
  "files": [
21
- "dist/index.js"
21
+ "dist/index.js",
22
+ "dist/resolveConfigWorker.js"
22
23
  ],
23
24
  "engines": {
24
25
  "node": ">=18.12",
@@ -76,7 +77,9 @@
76
77
  "rollup": "^2.75.7",
77
78
  "rollup-plugin-analyzer": "^4.0.0",
78
79
  "rollup-plugin-cleaner": "^1.0.0",
79
- "rollup-plugin-peer-deps-external": "^2.2.4"
80
+ "rollup-plugin-copy": "^3.5.0",
81
+ "rollup-plugin-peer-deps-external": "^2.2.4",
82
+ "synckit": "^0.9.0"
80
83
  },
81
84
  "peerDependencies": {
82
85
  "@bigbinary/neeto-cist": "latest",