Skip to content

Using the VS Code editor

ArchivesSpace provides a VS Code settings file that makes it easy for contributors using VS Code to follow the code style of the project. Using this tool chain in your editor helps fix code format and lint errors before committing files or running tests. In many cases such errors will be fixed automatically when the file being worked on is saved. Errors that can’t be fixed automatically will be highlighted with squiggly lines. Hovering your cursor over these lines will display a description of the error to help reach a solution.

Prerequisites

  1. Node.js
  2. Ruby
  3. VS Code

Set up VS Code

Add system dependencies

  1. ESLint
  2. Prettier
  3. Rubocop
  4. Stylelint

Rubocop

Terminal window
gem install rubocop

See https://docs.rubocop.org/rubocop/installation.html for further information, including using Bundler.

ESLint, Prettier, Stylelint

Run the following command from the ArchivesSpace root directory.

Terminal window
npm install

See package.json for further details on how these tools are used in ArchivesSpace.

Add VS Code extensions

Add the following extensions via the VS Code command palette or the Extensions panel. (See this documentation for installing and managing extensions).

  1. ESLint (dbaeumer.vscode-eslint)
  2. Prettier (esbenp.prettier-vscode)
  3. Ruby Rubocop Revised (LoranKloeze.ruby-rubocop-revived)
  4. Stylelint (stylelint.vscode-stylelint)

It’s important to note that since these extensions work in tandem with the VS Code settings file, these settings only impact your ArchivesSpace VS Code Workspace, not your global VS Code User settings.

The extensions should now work out of the box at this point providing error messages and autocorrecting fixable errors on file save!