-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci[minor]: add lint/format to ci (#169)
cc @hinthornw
- Loading branch information
Showing
13 changed files
with
357 additions
and
227 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
*/ | ||
|
||
const OFF = 0; | ||
const WARNING = 1; | ||
const ERROR = 2; | ||
|
||
module.exports = { | ||
root: true, | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
jest: true, | ||
node: true, | ||
}, | ||
parser: "@babel/eslint-parser", | ||
parserOptions: { | ||
allowImportExportEverywhere: true, | ||
}, | ||
extends: ["airbnb", "prettier"], | ||
plugins: ["react-hooks", "header"], | ||
ignorePatterns: [ | ||
"build", | ||
"docs/api", | ||
"node_modules", | ||
"docs/_static", | ||
"static", | ||
], | ||
rules: { | ||
// Ignore certain webpack alias because it can't be resolved | ||
"import/no-unresolved": [ | ||
ERROR, | ||
{ ignore: ["^@theme", "^@docusaurus", "^@generated"] }, | ||
], | ||
"import/extensions": OFF, | ||
"react/jsx-filename-extension": OFF, | ||
"react-hooks/rules-of-hooks": ERROR, | ||
"react/prop-types": OFF, // PropTypes aren't used much these days. | ||
"react/function-component-definition": [ | ||
WARNING, | ||
{ | ||
namedComponents: "function-declaration", | ||
unnamedComponents: "arrow-function", | ||
}, | ||
], | ||
"no-unused-vars": WARNING, | ||
"import/prefer-default-export": WARNING, | ||
"react/jsx-props-no-spreading": OFF, | ||
"no-empty-pattern": WARNING, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | ||
|
||
name: CI (Lint/Format) | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
workflow_dispatch: # Allows triggering the workflow manually in GitHub UI | ||
|
||
|
||
# If another push to the same PR or branch happens while this workflow is still running, | ||
# cancel the earlier run in favor of the next run. | ||
# | ||
# There's no point in testing an outdated version of the code. GitHub only allows | ||
# a limited number of job runners to be active at the same time, so it's better to cancel | ||
# pointless jobs early so that more useful jobs can run sooner. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint: | ||
name: Check linting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
- name: Install dependencies | ||
run: yarn install --immutable --mode=skip-build | ||
- name: Check linting | ||
run: yarn run lint | ||
|
||
format: | ||
name: Check formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js 18.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
- name: Install dependencies | ||
run: yarn install --immutable --mode=skip-build | ||
- name: Check formatting | ||
run: yarn run format:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,36 @@ | ||
import React from "react"; | ||
import { CodeTabs } from "./InstructionsWithCode"; | ||
|
||
export const ClientInstallationCodeTabs = () => ( | ||
<CodeTabs | ||
groupId="client-language" | ||
tabs={[ | ||
{ | ||
value: "python", | ||
label: "pip", | ||
language: "bash", | ||
content: `pip install -U langsmith`, | ||
}, | ||
{ | ||
value: "typescript", | ||
label: "yarn", | ||
language: "bash", | ||
content: `yarn add langsmith`, | ||
}, | ||
{ | ||
value: "npm", | ||
label: "npm", | ||
language: "bash", | ||
content: `npm install -S langsmith`, | ||
}, | ||
{ | ||
value: "pnpm", | ||
label: "pnpm", | ||
language: "bash", | ||
content: `pnpm add langsmith`, | ||
}, | ||
]} | ||
/> | ||
); | ||
export function ClientInstallationCodeTabs() { | ||
return ( | ||
<CodeTabs | ||
groupId="client-language" | ||
tabs={[ | ||
{ | ||
value: "python", | ||
label: "pip", | ||
language: "bash", | ||
content: `pip install -U langsmith`, | ||
}, | ||
{ | ||
value: "typescript", | ||
label: "yarn", | ||
language: "bash", | ||
content: `yarn add langsmith`, | ||
}, | ||
{ | ||
value: "npm", | ||
label: "npm", | ||
language: "bash", | ||
content: `npm install -S langsmith`, | ||
}, | ||
{ | ||
value: "pnpm", | ||
label: "pnpm", | ||
language: "bash", | ||
content: `pnpm add langsmith`, | ||
}, | ||
]} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.