Skip to content

Commit

Permalink
build: create a private package for shared eslint configs (#11240)
Browse files Browse the repository at this point in the history
## Summary

- Create a new package in `packages/eslint-config-calcite` that contains
shared ESLint configurations for importing in other packages.
- Setup the components and design-tokens packages to use the new shared
ESLint configs.
- Add typescript-eslint coverage to our github scripts 
- Check css files in lint-staged (previously it was only scss)
- Disable
[`no-unexpected-newline`](https://archive.eslint.org/docs/6.0.0/rules/no-unexpected-multiline),
which [conflicts with
prettier](prettier/eslint-config-prettier#32)
- Various other cleanup, such as formatting json files in `.vscode/` and
removing cspell ignore comments in favor of dictionary additions..
- Run `npm run lint` so unrelated changes don't appear in subsequent PRs
  • Loading branch information
benelan authored Jan 13, 2025
1 parent 26885c9 commit 03a0aad
Show file tree
Hide file tree
Showing 56 changed files with 323 additions and 445 deletions.
1 change: 1 addition & 0 deletions .github/scripts/addCalcitePackageLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = async ({ github, context }) => {
github,
context,
label: package,
// eslint-disable-next-line @cspell/spellchecker -- hex color
color: "BFBEAF",
description: `Issues specific to the @esri/${package} package.`,
});
Expand Down
36 changes: 18 additions & 18 deletions .github/scripts/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
const cspellPlugin = require("@cspell/eslint-plugin");
const eslint = require("@eslint/js");
const globals = require("globals");
const eslint = require("@eslint/js");
const tseslint = require("typescript-eslint");
const cspellPlugin = require("@cspell/eslint-plugin");

module.exports = [
eslint.configs.recommended,
{
files: ["**/*.{c,m,}js"],
plugins: { "@cspell": cspellPlugin },
module.exports = tseslint.config({
files: ["**/*.{c,m,}js"],
extends: [eslint.configs.recommended, tseslint.configs.recommended],
plugins: { "@cspell": cspellPlugin },

languageOptions: {
ecmaVersion: 2021,
sourceType: "commonjs",
globals: {
...globals.node,
},
languageOptions: {
ecmaVersion: 2021,
sourceType: "commonjs",
globals: {
...globals.node,
},
},

rules: {
"comma-dangle": "off",
"@cspell/spellchecker": ["warn", {}],
},
rules: {
"comma-dangle": "off",
"@cspell/spellchecker": ["warn", {}],
"@typescript-eslint/no-require-imports": "off",
},
];
});
2 changes: 1 addition & 1 deletion .github/scripts/omitPrFromChangelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ module.exports = async ({ github, context }) => {
body: newPullRequestBody,
});
} else {
console.log(`The \`no changleog entry\` label is not present on this PR.`);
console.log(`The \`no changelog entry\` label is not present on this PR.`);
}
};
2 changes: 1 addition & 1 deletion .github/scripts/trackMilestoneEstimates.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = async ({ github, context, core }) => {
};

const issues = await github.paginate(github.rest.issues.listForRepo, {
// @ts-ignore milestone.number is valid: https://docs.github.com/en/rest/issues/issues#list-repository-issues--parameters
// @ts-expect-error milestone.number is valid: https://docs.github.com/en/rest/issues/issues#list-repository-issues--parameters
milestone: milestone.number,
owner: owner,
repo: repo,
Expand Down
2 changes: 1 addition & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
"*.{json,html,yml}": ["prettier --write"],
"*.scss": ["stylelint --fix", "prettier --write"],
"*.{s,}css": ["stylelint --fix", "prettier --write"],
"*.md": ["prettier --write", "markdownlint --fix"],
};
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Inappropriate/unacceptable behavior is anything hurtful that interferes with oth
- Foul or obscene language
- Stalking
- Sharing graphic or derogatory pictures, drawings, or cartoons
- _Ad hominem_ or personal attacks and insults
- *Ad hominem* or personal attacks and insults
- Unwanted or offensive letters or poems
- Offensive email, voicemail messages, or social media postings
- Personal threats
Expand Down
29 changes: 9 additions & 20 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"build": "turbo run build --log-order=stream",
"clean": "turbo run clean --log-order=stream && git clean -fd",
"lint": "concurrently \"npm:lint:*\" \"turbo run lint --log-order=stream\"",
"lint:md": "prettier --write \"**/*.md\" >/dev/null && markdownlint \"{,documentation}/*.md\" --fix --dot --ignore-path .gitignore",
"lint:md": "prettier --write \"*.md\" >/dev/null && markdownlint --fix \"*.md\"",
"lint:yml": "prettier --write \".github/**/*.yml\" >/dev/null",
"lint:js": "eslint -c .github/scripts/eslint.config.cjs --fix .github/scripts/ && prettier --write \".github/**/*.{c,m,}js\" >/dev/null",
"lint:json": "prettier --write \"*.json\" >/dev/null",
"lint:json": "prettier --write \"{.vscode,}/*.json\" >/dev/null",
"version:latest": "./support/release.sh version",
"publish:latest": "./support/release.sh publish",
"version:next": "./support/release.sh version next",
Expand All @@ -39,8 +39,6 @@
"@cspell/dict-pokemon": "1.0.0",
"@cspell/dict-scientific-terms-us": "3.0.5",
"@cspell/eslint-plugin": "8.17.1",
"@eslint/compat": "1.2.4",
"@eslint/eslintrc": "3.2.0",
"@eslint/js": "9.17.0",
"@esri/calcite-base": "1.2.0",
"@octokit/webhooks-types": "7.6.1",
Expand Down
Loading

0 comments on commit 03a0aad

Please sign in to comment.