Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/large-experts-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* This is a very stripped-down eslintrc, because @khanacademy/eslint-config
* assumes you're using react & flow (and requires a lot of dependencies along
* with it).
*/
const khan = require("@khanacademy/eslint-config");

// Only keep the rules that have no prefix (so are included in eslint core)
// and the prettier rule.
Comment on lines +8 to +9

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look at khan/eslint-config-khan and see that everything's listed as a peer dep. I wonder if we should change that.

const basicRules = {};
Object.keys(khan.rules).forEach((key) => {
if (!key.includes("/") || key.startsWith("prettier/")) {
basicRules[key] = khan.rules[key];
}
});

module.exports = {
extends: ["eslint:recommended", "prettier"],
plugins: ["prettier"],
rules: basicRules,
env: {
node: true,
},
parserOptions: {
sourceType: "module",
ecmaVersion: 2022,
},
};
6 changes: 4 additions & 2 deletions .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
- pull_request

jobs:
changeset:
name: Check for .changeset file
check:
name: Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Khan/actions@check-for-changeset-v0.0.0
- uses: Khan/actions@shared-node-cache-v0.0.2
- run: yarn lint
1 change: 1 addition & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("@khanacademy/eslint-config/.prettierrc.js");
11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
"workspaces": [
"actions/*"
],
"scripts": {
"lint": "eslint --ext .js,.mjs .",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realize you pass a comma separated list to --ext, cool!

"fix": "yarn lint --fix"
},
"devDependencies": {
"@changesets/cli": "^2.22.0"
"@changesets/cli": "^2.22.0",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"@khanacademy/eslint-config": "^0.1.0",
"prettier": "^2.6.2"
}
}
5 changes: 4 additions & 1 deletion utils/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ export const buildPackage = (name, packageJsons, monorepoName) => {
if (packageJsons[name].dependencies) {
const yml = `actions/${name}/dist/action.yml`;
const actionYml = fs.readFileSync(yml, "utf8");
fs.writeFileSync(yml, processActionYml(name, packageJsons, actionYml, monorepoName));
fs.writeFileSync(
yml,
processActionYml(name, packageJsons, actionYml, monorepoName),
);
}
return dist;
};
Loading