bmatcuk / eslint-plugin-postcss-modules

Checks that you are using the classes exported by your css modules using postcss.
MIT License
21 stars 7 forks source link

Remove dependency on deasync? #19

Closed sidharthv96 closed 3 years ago

sidharthv96 commented 3 years ago

It is causing docker builds to fail when using the node image without python. The functionality seems to be similar to await promiseFunction().

https://github.com/mermaid-js/mermaid-live-editor/issues/59#issuecomment-854401252


 > [mermaid-live-editor-builder 4/5] RUN yarn install:
#8 0.643 yarn install v1.22.5
#8 0.712 [1/4] Resolving packages...
#8 0.875 [2/4] Fetching packages...
#8 18.20 info fsevents@2.3.2: The platform "linux" is incompatible with this module.
#8 18.20 info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
#8 18.20 [3/4] Linking dependencies...
#8 18.21 warning "analytics > @analytics/core > analytics-utils@0.4.4" has unmet peer dependency "@types/dlv@^1.0.0".
#8 18.21 warning "@sveltejs/kit > @sveltejs/vite-plugin-svelte > @rollup/pluginutils@4.1.0" has unmet peer dependency "rollup@^1.20.0||^2.0.0".
#8 21.43 [4/4] Building fresh packages...
#8 21.75 error /home/node_modules/deasync: Command failed.
#8 21.75 Exit code: 1
#8 21.75 Command: node ./build.js
#8 21.75 Arguments:
#8 21.75 Directory: /home/node_modules/deasync
#8 21.75 Output:
#8 21.75 gyp info it worked if it ends with ok
#8 21.75 gyp info using node-gyp@5.1.0
#8 21.75 gyp info using node@14.16.0 | linux | arm64
#8 21.75 gyp ERR! find Python
#8 21.75 gyp ERR! find Python Python is not set from command line or npm configuration
#8 21.75 gyp ERR! find Python Python is not set from environment variable PYTHON
#8 21.75 gyp ERR! find Python checking if "python" can be used
#8 21.75 gyp ERR! find Python - "python" is not in PATH or produced an error
#8 21.75 gyp ERR! find Python checking if "python2" can be used
#8 21.75 gyp ERR! find Python - "python2" is not in PATH or produced an error
#8 21.75 gyp ERR! find Python checking if "python3" can be used
#8 21.75 gyp ERR! find Python - "python3" is not in PATH or produced an error
#8 21.75 gyp ERR! find Python
#8 21.75 gyp ERR! find Python **********************************************************
#8 21.75 gyp ERR! find Python You need to install the latest version of Python.
#8 21.75 gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
#8 21.75 gyp ERR! find Python you can try one of the following options:
#8 21.75 gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
#8 21.75 gyp ERR! find Python   (accepted by both node-gyp and npm)
#8 21.75 gyp ERR! find Python - Set the environment variable PYTHON
#8 21.75 gyp ERR! find Python - Set the npm configuration variable python:
#8 21.75 gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
#8 21.75 gyp ERR! find Python For more information consult the documentation at:
#8 21.75 gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
#8 21.75 gyp ERR! find Python **********************************************************
#8 21.75 gyp ERR! find Python
#8 21.75 gyp ERR! configure error
#8 21.75 gyp ERR! stack Error: Could not find any Python installation to use
#8 21.75 gyp ERR! stack     at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
#8 21.75 gyp ERR! stack     at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
#8 21.75 gyp ERR! stack     at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
#8 21.75 gyp ERR! stack     at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
#8 21.75 gyp ERR! stack     at exithandler (child_process.js:315:5)
#8 21.75 gyp ERR! stack     at ChildProcess.errorhandler (child_process.js:327:5)
#8 21.75 gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
#8 21.75 gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
#8 21.75 gyp ERR! stack     at onErrorNT (internal/child_process.js:465:16)
#8 21.75 gyp ERR! stack     at processTicksAndRejections (internal/process/task_queues.js:80:21)
#8 21.75 gyp ERR! System Linux 5.10.25-linuxkit
#8 21.75 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
#8 21.75 gyp ERR! cwd /home/node_modules/deasync
#8 21.75 gyp ERR! node -v v14.16.0
#8 21.75 gyp ERR! node-gyp -v v5.1.0
#8 21.75 gyp ERR! not ok
#8 21.75 Build failed
#8 21.75 info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
------
executor failed running [/bin/sh -c yarn install]: exit code: 1
bmatcuk commented 3 years ago

Unfortunately, await is not the same as deasync. The problem is that eslint requires that plugins run synchronously, but postcss can run asynchronously - await still runs asynchronously and returns a promise, which won't work. Whereas deasync is a bit of a hack to block the main node thread, forcing an asynchronous task to run synchronously.

I'd recommend taking a look at deasync's documentation to install its dependencies in your docker container.

sidharthv96 commented 3 years ago

Ohh.. I saw this waring on the main repo, so got a bit confused.

it's just a hack and I'd strongly recommend not to use it for anything.

I've changed the build image to node instead of node-alpine to fix the issue. Thanks for the confirmation!