From 6e769bad4b48923d054f4d68a0a2c7787a41f21f Mon Sep 17 00:00:00 2001 From: Rick van Lieshout Date: Tue, 15 Jul 2025 14:39:37 +0200 Subject: [PATCH] version bump and build --- .eslintignore | 7 ---- .eslintrc | 62 ------------------------------- .stylelintrc | 19 ++++++---- eslint.config.js | 64 ++++++++++++++++++++++++++++++++ prettier/index.js | 86 +++++++++++++++++++++++++------------------ prettier/package.json | 29 ++++++++++++--- 6 files changed, 149 insertions(+), 118 deletions(-) delete mode 100644 .eslintignore delete mode 100644 .eslintrc create mode 100644 eslint.config.js diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 158e0db..0000000 --- a/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -*.scss -*.d.ts -*.spec.ts -main.browser.ts -idex.js -node_modules/* -*.e2e.* diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 7d00761..0000000 --- a/.eslintrc +++ /dev/null @@ -1,62 +0,0 @@ -{ - "env": { - "browser": true, - "jest": true, - "es6": true, - }, - "plugins": ["import"], - "extends": ["eslint:recommended", "prettier"], - "parserOptions": { - "ecmaVersion": 2020, - "sourceType": "module" - }, - "rules": { - "no-console": [ - "error", - { - "allow": ["debug", "error"] - } - ], - "no-eval": "error", - "import/first": "error", - "camelcase": [ - "error", - { - "ignoreImports": true, - "ignoreDestructuring": true - } - ], - "consistent-return": "warn", - "comma-dangle": ["warn", "always-multiline"], - "constructor-super": "error", - "curly": "error", - "eol-last": "warn", - "eqeqeq": ["error", "smart"], - "import/order": "always", - "new-parens": "error", - "no-debugger": "error", - "no-fallthrough": "off", - "max-len": [ - "warn", - { - "code": 100 - } - ], - "no-shadow": [ - "error", - { - "hoist": "all" - } - ], - "no-trailing-spaces": "warn", - "no-underscore-dangle": "error", - "no-unsafe-finally": "error", - "no-var": "error", - "object-shorthand": "error", - "one-var": ["error", "never"], - "prefer-arrow/prefer-arrow-functions": "off", - "prefer-const": "error", - "radix": "off", - "space-in-parens": ["off", "never"] - } -} diff --git a/.stylelintrc b/.stylelintrc index a20e387..89b8298 100644 --- a/.stylelintrc +++ b/.stylelintrc @@ -1,4 +1,5 @@ { + "defaultSeverity": "error", "extends": [ "stylelint-config-standard", "stylelint-config-recommended-scss", @@ -12,10 +13,7 @@ "except": ["empty"] } ], - "declaration-empty-line-before":[ - "never", - ], - "comment-empty-line-before":[ + "comment-empty-line-before": [ "always", { "except": ["first-nested"], @@ -27,7 +25,6 @@ "color-hex-length": "long", "selector-pseudo-element-colon-notation": "single", "selector-attribute-quotes": "always", - "string-quotes": "double", "max-nesting-depth": 3, "selector-max-specificity": "0,3,2", "declaration-no-important": true, @@ -54,7 +51,15 @@ } ], "unit-allowed-list": ["px", "%", "em", "rem", "vw", "vh", "deg", "s"], - "max-empty-lines": 2, - "max-line-length": 120 + "color-named": "never", + "font-family-no-missing-generic-family-keyword": null, + "font-weight-notation": "named-where-possible", + "function-url-no-scheme-relative": true, + "no-descending-specificity": true, + "no-duplicate-selectors": true, + "order/order": [["custom-properties", "declarations"]], + "order/properties-alphabetical-order": true, + "property-no-unknown": [true, { "ignoreProperties": ["/^lost-/"] }], + "value-keyword-case": "lower" } } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..dbf42d5 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,64 @@ +const mastermindzhConfig = require("@mastermindzh/eslint-config"); +const typescriptEslint = require("@typescript-eslint/eslint-plugin"); +const typescriptParser = require("@typescript-eslint/parser"); +const importPlugin = require("eslint-plugin-import"); + +module.exports = [ + // Global ignores (replaces .eslintignore) + { + ignores: [ + "dist/**", + "build/**", + "public/**", + ".cache/**", + "node_modules/**", + "*.config.js", + "*.config.ts", + ], + }, + ...mastermindzhConfig, + { + // Only lint TypeScript files (matching your .eslintignore pattern) + files: ["**/*.ts", "**/*.tsx"], + languageOptions: { + parser: typescriptParser, + parserOptions: { + project: "./tsconfig.json", + }, + }, + plugins: { + "@typescript-eslint": typescriptEslint, + import: importPlugin, + }, + // Your project-specific rules + rules: { + // Import rules + "import/no-extraneous-dependencies": [ + "error", + { + devDependencies: [ + "**/*.test.ts", + "**/*.test.tsx", + "**/internal/**/*.ts", + ], + }, + ], + // TypeScript rules + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-use-before-define": "off", + // Use the correct rule name for quotes + quotes: ["error", "double"], + "@typescript-eslint/naming-convention": [ + "error", + { + format: ["camelCase", "UPPER_CASE", "snake_case", "PascalCase"], + leadingUnderscore: "allow", + selector: "parameter", + }, + ], + // Shadow rules + "no-shadow": "off", + "@typescript-eslint/no-shadow": "error", + }, + }, +]; diff --git a/prettier/index.js b/prettier/index.js index 66968a6..94e4553 100644 --- a/prettier/index.js +++ b/prettier/index.js @@ -1,43 +1,57 @@ module.exports = { - // line length + // Line length - optimized for modern development printWidth: 100, - // indentation type + // Use spaces instead of tabs for consistency useTabs: false, - - // whether to prefer ' over " - singleQuote: false, - - // whether we want to quote props (only-if-they-have-a-dash) - quoteProps: "as-needed", - - // add trailing comma's everwhere as long as it's supported by es5 - trailingComma: "es5", - - // space brackets method ( param1, param2 ) { } - bracketSpacing: true, - - // places the > sign on a newline when closing a long html tag - jsxBracketSameLine: false, - - // always add parentheses on arrow functions (x) => { } - arrowParens: "always", - - // ignore pragma, run prettier on all files - requirePragma: false, - - // preserve markdown text as-is - proseWrap: "preserve", - - // make css leading in whitespace sensitivity - htmlWhitespaceSensitivity: "css", - - // always end lines with lf - endOfLine: "lf", - - // tabs are 2 spaces. tabWidth: 2, - // always end statements with a semicolon - semi: true + // Use double quotes for consistency with JSON and HTML attributes + singleQuote: false, + + // JSX quotes - use double quotes to match regular quotes + jsxSingleQuote: false, + + // Only quote object properties when needed + quoteProps: "as-needed", + + // Use trailing commas for all ES2017+ features (better for git diffs) + trailingComma: "all", + + // Add spaces inside object braces { foo: bar } + bracketSpacing: true, + + // Put closing > on new line for JSX elements (better readability) + bracketSameLine: false, + + // Always use parentheses around arrow function parameters for consistency + arrowParens: "always", + + // Format all files, don't require pragma comments + requirePragma: false, + insertPragma: false, + + // Preserve markdown line breaks as-is (better for documentation) + proseWrap: "preserve", + + // CSS whitespace handling - strict for better consistency + htmlWhitespaceSensitivity: "css", + + // Consistent line endings across platforms + endOfLine: "lf", + + // Always include semicolons for clarity and consistency + semi: true, + + // Don't force single attribute per line (allows flexibility) + singleAttributePerLine: false, + + // Format embedded languages automatically + embeddedLanguageFormatting: "auto", + + // Experimental: Control Vue SFC formatting + vueIndentScriptAndStyle: false, + + // Enhanced experimental features for future-proofing + experimentalTernaries: false, }; diff --git a/prettier/package.json b/prettier/package.json index 3acbe6d..a037b3a 100644 --- a/prettier/package.json +++ b/prettier/package.json @@ -1,13 +1,20 @@ { "name": "@mastermindzh/prettier-config", - "version": "1.0.0", - "description": "My preferred prettier config", + "version": "1.1.0", + "description": "My preferred prettier config with modern best practices", "main": "index.js", + "type": "commonjs", + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "prettier": ">=3.0.0" + }, "scripts": { "patch": "npm --no-git-tag-version version patch", "minor": "npm --no-git-tag-version version minor", "major": "npm --no-git-tag-version version major", - "release": "git add -A && git commit -m 'version bump and build' && npm publish --access public && echo 'All done, don't forget to push!'", + "release": "git add -A && git commit -m \"version bump and build\" && npm publish --access public && echo \"All done, don't forget to push!\"", "release-patch": "npm run patch && npm run release", "release-minor": "npm run minor && npm run release", "release-major": "npm run major && npm run release" @@ -19,14 +26,24 @@ "keywords": [ "prettier", "config", + "configuration", + "code-style", + "formatting", + "javascript", + "typescript", + "react", + "vue", "mastermindzh", - "rick van lieshout", - "lieshout" + "rick van lieshout" ], "author": "Rick van Lieshout", "license": "MIT", "bugs": { "url": "https://github.com/Mastermindzh/prettier-config/issues" }, - "homepage": "https://github.com/Mastermindzh/prettier-config#readme" + "homepage": "https://github.com/Mastermindzh/prettier-config#readme", + "files": [ + "index.js", + "README.md" + ] }