Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into chore/build-and-test-jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
iOvergaard committed Jul 3, 2024
2 parents e4f6f28 + 391065f commit 4929094
Show file tree
Hide file tree
Showing 440 changed files with 3,431 additions and 2,550 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

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

This file was deleted.

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

0 comments on commit 4929094

Please sign in to comment.