Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump eslint from 8.57.0 to 9.6.0 #2073

Merged
merged 22 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

105 changes: 0 additions & 105 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache: npm
cache-dependency-path: package-lock.json
- run: npm ci --no-audit --no-fund --prefer-offline
- run: npm run lint:errors
- run: npm run build
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Ignore auto-generated backend-api files
src/external/backend-api/src
src/packages/core/icon-registry/icons.ts
src/packages/core/icon-registry/icons
17 changes: 16 additions & 1 deletion devops/eslint/rules/exported-string-constant-naming.cjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,31 @@
/** @type {import('eslint').Rule.RuleModule}*/
module.exports = {
meta: {
type: 'problem',
docs: {
description:
'Ensure all exported string constants should be in uppercase with words separated by underscores and prefixed with UMB_',
},
schema: [
{
type: 'object',
properties: {
excludedFileNames: {
type: 'array',
items: {
type: 'string',
},
},
},
additionalProperties: false,
},
],
},
create: function (context) {
const excludedFileNames = context.options[0]?.excludedFileNames || [];
return {
ExportNamedDeclaration(node) {
const fileName = context.getFilename();
const fileName = context.filename;

if (excludedFileNames.some((excludedFileName) => fileName.includes(excludedFileName))) {
// Skip the rule check for files in the excluded list
Expand Down
96 changes: 96 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import js from "@eslint/js";
import globals from "globals";
import importPlugin from "eslint-plugin-import";
import localRules from "eslint-plugin-local-rules";
import wcPlugin from "eslint-plugin-wc";
import litPlugin from "eslint-plugin-lit";
import litA11yPlugin from "eslint-plugin-lit-a11y";
import storybookPlugin from "eslint-plugin-storybook";
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
import tseslint from 'typescript-eslint';

export default [
// Recommended config applied to all files
js.configs.recommended,
...tseslint.configs.recommended,
eslintPluginPrettierRecommended,

// Global ignores
{
ignores: [
"**/rollup.config.js",
"**/vite.config.ts",
"src/external",
"src/packages/core/icon-registry/icons",
"src/packages/core/icon-registry/icons.ts"
],
},

// Global config
{
languageOptions: {
parserOptions: {
project: true,
tsconfigRootDir: import.meta.dirname,
},
globals: {
...globals.browser,
}
},
plugins: {
import: importPlugin,
"local-rules": localRules,
"wc": wcPlugin,
"lit": litPlugin,
"lit-a11y": litA11yPlugin,
"storybook": storybookPlugin
},
rules: {
semi: ["warn", "always"],
"no-unused-vars": "warn",
"no-var": "error",
"import/no-unresolved": "off",
"import/order": ["warn", { "groups": ["builtin", "parent", "sibling", "index", "external"] }],
"import/no-self-import": "error",
"import/no-cycle": ["error", { "maxDepth": 6, "allowUnsafeDynamicCyclicDependency": true }],
"local-rules/bad-type-import": "error",
"local-rules/enforce-element-suffix-on-element-class-name": "error",
"local-rules/enforce-umb-prefix-on-element-name": "error",
"local-rules/ensure-relative-import-use-js-extension": "error",
"local-rules/no-direct-api-import": "warn",
"local-rules/prefer-import-aliases": "error",
"local-rules/prefer-static-styles-last": "warn",
"local-rules/umb-class-prefix": "error",
"local-rules/no-relative-import-to-import-map-module": "error",
"local-rules/enforce-umbraco-external-imports": [
"error",
{
"exceptions": ["@umbraco-cms", "@open-wc/testing", "@storybook", "msw", ".", "vite"]
}
],
"local-rules/exported-string-constant-naming": [
"error",
{
"excludedFileNames": ["umbraco-package", "input-tiny-mce.defaults"] // TODO: what to do about the tiny mce defaults?
}
],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "warn"
}
},

// Pattern-specific overrides
{
files: ['**/*.js'],
...tseslint.configs.disableTypeChecked,
languageOptions: {
globals: {
...globals.node,
}
}
},
];
Loading
Loading