Skip to content

Commit

Permalink
Update actions to Node 20 (#1464)
Browse files Browse the repository at this point in the history
* Update actions to Node 20

* Update minimum node to 20

* Update package to node 20

Also updates babel, typescript, jest

* Update to eslint 9

* Add changeset

* Update rollup
  • Loading branch information
somewhatabstract authored Jun 14, 2024
1 parent 9d005ff commit fcc3a96
Show file tree
Hide file tree
Showing 10 changed files with 1,723 additions and 1,023 deletions.
9 changes: 9 additions & 0 deletions .changeset/fast-otters-applaud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"ancesdir": major
---

BREAKING CHANGE:
- Drop support for Node 16 and Node 18. Node 20 is now the minimum required version.

HOUSEKEEPING:
- Updated various development dependencies like eslint, prettier, typescript, babel, etc.
4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

130 changes: 0 additions & 130 deletions .eslintrc.js

This file was deleted.

20 changes: 10 additions & 10 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- name: Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
uses: Khan/actions@shared-node-cache-v2
with:
node-version: ${{ matrix.node-version }}
- name: Lint
run: yarn lint
- name: Types
run: yarn typecheck
- name: Changesets check
uses: Khan/actions@check-for-changeset-v0
uses: Khan/actions@check-for-changeset-v1
if: |
github.actor != 'dependabot[bot]' &&
github.actor != 'dependabot-preview[bot]' &&
Expand All @@ -46,17 +46,17 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
uses: Khan/actions@shared-node-cache-v2
with:
node-version: ${{ matrix.node-version }}
- name: Run tests with coverage
run: yarn coverage
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

Expand All @@ -70,11 +70,11 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node-version: [16.x, 18.x]
node-version: [20.x]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
uses: Khan/actions@shared-node-cache-v2
with:
node-version: ${{ matrix.node-version }}
- name: Run tests and build
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Install & cache node_modules
uses: Khan/actions@shared-node-cache-v0
uses: Khan/actions@shared-node-cache-v2
with:
node-version: 16.x
node-version: 20.x

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
"@babel/preset-env",
{
targets: {
node: "16",
node: "20",
},
},
],
Expand Down
164 changes: 164 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import eslintComments from "eslint-plugin-eslint-comments";
import _import from "eslint-plugin-import";
import jest from "eslint-plugin-jest";
import babel from "@babel/eslint-plugin";
import {fixupPluginRules} from "@eslint/compat";
import globals from "globals";
import path from "node:path";
import {fileURLToPath} from "node:url";
import js from "@eslint/js";
import {FlatCompat} from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: [
"**/node_modules",
"flow-typed/**/*.js",
"**/coverage",
"**/dist",
],
},
...compat.extends("@khanacademy"),
{
plugins: {
"eslint-comments": eslintComments,
import: fixupPluginRules(_import),
jest,
"@babel": babel,
},

languageOptions: {
globals: {
...globals.jest,
...globals.node,
},
},

rules: {
"constructor-super": "error",
curly: "error",
eqeqeq: ["error", "allow-null"],
"generator-star-spacing": "error",
"guard-for-in": "error",
"linebreak-style": ["error", "unix"],
"no-alert": "error",
"no-array-constructor": "error",
"no-console": "error",
"no-debugger": "error",
"no-dupe-class-members": "error",
"no-dupe-keys": "error",
"no-extra-bind": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-throw-literal": "error",
"@babel/no-invalid-this": "error",
"no-with": "error",
"no-async-promise-executor": "error",
"no-const-assign": "error",

"no-else-return": [
"error",
{
allowElseIf: false,
},
],

"no-irregular-whitespace": "off",
"no-multi-str": "error",
"no-prototype-builtins": "off",

"no-restricted-syntax": [
"error",
{
selector: "IntersectionTypeAnnotation",
message:
"Use exact object types and the spread operator instead",
},
],

"no-return-await": "error",
"no-this-before-super": "error",
"no-useless-catch": "off",
"no-useless-call": "error",
"no-undef": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unused-expressions": "error",

"no-unused-vars": [
"error",
{
args: "none",
varsIgnorePattern: "^_*$",
},
],

"no-var": "error",
"one-var": ["error", "never"],
"prefer-const": "error",
"prefer-spread": "error",
"require-await": "error",
"require-yield": "error",
"prefer-template": "off",
"arrow-parens": "off",
"prefer-arrow-callback": "off",
"no-case-declarations": "off",
"valid-jsdoc": "off",
"require-jsdoc": "off",
"eslint-comments/no-unlimited-disable": "error",
"eslint-comments/no-unused-disable": "error",

"import/extensions": [
"error",
"never",
{
ignorePackages: true,
},
],

"import/no-cycle": [
"error",
{
ignoreExternal: true,
commonjs: true,
maxDepth: 6,
},
],

"import/named": "error",
"import/default": "error",
"import/namespace": "error",

"import/no-unassigned-import": [
"error",
{
allow: ["@jest/globals", "jest-extended"],
},
],

"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-contain": "error",
"jest/prefer-to-have-length": "error",
"jest/valid-title": "error",

"prettier/prettier": [
"error",
{
tabWidth: 4,
trailingComma: "all",
bracketSpacing: false,
},
],
},
},
];
Loading

0 comments on commit fcc3a96

Please sign in to comment.