To use pipeline operator now there are two options:
@babel/plugin-proposal-pipeline-operatorplugin@babel/preset-stage-1preset
In both options we use babel. Babel options comes in .babelrc.
- Install ESLint extension
- Create
.eslintrc.json(see it in project dir). .babelrcwith options must exists.- Install packages
eslint,babel-eslint. - In VS Code settings disable javascript validation (
"javascript.validate.enable": false), eslint validation must be enabled by default after install extension. See.vscode/settings.json
git clone https://github.com/maestrow/pipeline-operator-in-js-howto
If you want only |> operator plugin (1st option), then go to first commit (git checkout 8d13384052ca7500bc08ac48c7eb05c777c20510).
If you want all stage 1 proposals (2nd option), it comes from second commit.
npm i # install all dependencies
npm start # it runs `pipe.js` (`'asdasd' |> (x => x.length) |> console.log;`), full command see in `package.json`.
See 6 in output.
Open pipe.js in VS Code and make sure that linter doesn't report an error.