This repository contains standard config files for use by our projects.
Config NPM to route the @thelabnyc scope to Gitlab:
echo '@thelabnyc:registry=https://gitlab.com/api/v4/groups/269576/-/packages/npm/' >> .npmrcRun install script. For details of what this script does, see bin/install.sh.
npx --package='@thelabnyc/standards' install-thelab-standardsConfig NPM to route the @thelabnyc scope to Gitlab:
echo '@thelabnyc:registry=https://gitlab.com/api/v4/groups/269576/-/packages/npm/' >> .npmrcInstall package:
npm i --save-dev '@thelabnyc/standards'Docs: Commitlint
Add a file called .commitlintrc.ts to your project root with the following content:
import type { UserConfig } from "@commitlint/types";
const Configuration: UserConfig = {
extends: ["@thelabnyc/standards/commitlint.mjs"],
};
export default Configuration;Use git log --oneline to find the short hash of the previous commit and take note of it
Add the following NPM script to package.json:
"check:lint-commits": "commitlint --from deadbeef" (where deadbeef is the short hash from the previous step)
Add the new script to package.json, then add a call to check:lint in the check NPM script.
{
"scripts": {
"check:lint-commits": "commitlint --from ${CI_MERGE_REQUEST_DIFF_BASE_SHA:-HEAD~10}",
"check:lint": "npm run check:lint-commits && npm run check:lint-css && npm run check:lint-js && npm run check:lint-markdown"
}
}Docs: EditorConfig
Symlink the .editorconfig file to the root of your project.
ln -s ./node_modules/@thelabnyc/standards/.editorconfig .editorconfigDocs: ESLint
Add an ESLint config file that extends @thelabnyc/standards/eslint.mjs.
Example eslint.config.mjs:
import path from "node:path";
import { fileURLToPath } from "node:url";
import { getTSConfig } from "@thelabnyc/standards/eslint.mjs";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default getTSConfig({
parserOptions: {
tsconfigRootDir: __dirname,
},
});Symlink the .markdownlint.json file to the root of your project.
ln -s ./node_modules/@thelabnyc/standards/.markdownlint.json .markdownlint.jsonDocs: Prettier
Add a Prettier config file that extends @thelabnyc/standards/prettier.config.
Example prettier.config.js:
const base = require("@thelabnyc/standards/prettier.config");
module.exports = {
...base,
};Docs: Stylelint
Add a stylelint config file that extends @thelabnyc/standards/rules/stylelint.
Example .stylelintrc.json:
{
"extends": "@thelabnyc/standards/stylelint.config"
}