Cleanup tools (#1756)

* Use prettier own instead of eslint plugin

* Extend prettier config angular eslint

* Upgrade root prettier to 3

* Fix css syntax errors

* Change eslint ignore to prettier ignore

* Ignore formatting for outputs

* Fix lint-staged error when edited multiple files

* Bump pnpm version

* Remove unnecessary pnpm config

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>

authored by Han Yeong-woo Eric Fennis and committed by GitHub 675158df 042393a9

Changed files
+79 -99
.github
docs
guide
advanced
examples
global-styling-absolute-strokewidth-example
global-styling-css-example
packages
lucide-angular
lucide-vue
scripts
+1 -10
.eslintrc.js
··· 7 7 node: true, 8 8 }, 9 9 extends: ['airbnb-base', 'prettier'], 10 - plugins: ['import', 'prettier', '@html-eslint'], 10 + plugins: ['import', '@html-eslint'], 11 11 rules: { 12 12 'no-console': 'off', 13 13 'no-param-reassign': 'off', 14 14 'no-shadow': 'off', 15 15 'no-use-before-define': 'off', 16 - 'prettier/prettier': [ 17 - 'error', 18 - { 19 - singleQuote: true, 20 - trailingComma: 'all', 21 - printWidth: 100 22 - }, 23 - ], 24 16 'import/no-extraneous-dependencies': [ 25 17 'error', 26 18 { devDependencies: ['**/*.test.js', '**/*.spec.js', './scripts/**'] }, ··· 46 38 files: ['./icons/*.svg'], 47 39 parser: '@html-eslint/parser', 48 40 rules: { 49 - 'prettier/prettier': 'off', 50 41 '@html-eslint/require-doctype': 'off', 51 42 '@html-eslint/no-duplicate-attrs': 'error', 52 43 '@html-eslint/no-inline-styles': 'error',
+1 -1
.github/actions/build-and-test.yml
··· 18 18 name: Install pnpm 19 19 id: pnpm-install 20 20 with: 21 - version: 7 21 + version: 8 22 22 run_install: false 23 23 24 24 - name: Get pnpm store directory
+1 -1
.github/actions/check-icons.yml
··· 18 18 name: Install pnpm 19 19 id: pnpm-install 20 20 with: 21 - version: 7 21 + version: 8 22 22 run_install: false 23 23 24 24 - name: Get pnpm store directory
+16
.prettierignore
··· 1 + pnpm-lock.yaml 2 + 3 + # lucide-angular 4 + packages/lucide-angular/.angular/cache 5 + 6 + # lucide-static 7 + packages/lucide-static/icons 8 + packages/lucide-static/lib 9 + packages/lucide-static/sprite.svg 10 + packages/lucide-static/tags.json 11 + packages/lucide-static/icon-nodes.json 12 + packages/lucide-static/font 13 + 14 + # lucide-svelte 15 + packages/lucide-svelte/src/icons/*.svelte 16 + packages/lucide-svelte/.svelte-kit
+1 -1
docs/guide/advanced/examples/global-styling-absolute-strokewidth-example/icon.css
··· 11 11 .app { 12 12 display: grid; 13 13 grid-template-columns: 1fr 1fr 1fr; 14 - grid-template-rows: 1fr 1fr 1fr 14 + grid-template-rows: 1fr 1fr 1fr; 15 15 gap: 6px; 16 16 }
+1 -1
docs/guide/advanced/examples/global-styling-css-example/icon.css
··· 9 9 .app { 10 10 display: grid; 11 11 grid-template-columns: 1fr 1fr 1fr; 12 - grid-template-rows: 1fr 1fr 1fr 12 + grid-template-rows: 1fr 1fr 1fr; 13 13 gap: 6px; 14 14 }
+23
lint-staged.config.mjs
··· 1 + /** 2 + * @param {string[]} filenames 3 + * @returns {string} 4 + */ 5 + const filenamesToAjvOption = (filenames) => filenames.map((filename) => `-d ${filename}`).join(' '); 6 + 7 + /** @satisfies {import('lint-staged').Config} */ 8 + const config = { 9 + 'icons/*.svg': [ 10 + 'node ./scripts/optimizeStagedSvgs.mjs', 11 + 'node ./scripts/generateNextJSAliases.mjs', 12 + ], 13 + 'icons/*.json': (filenames) => [ 14 + `ajv --spec=draft2020 -s icon.schema.json ${filenamesToAjvOption(filenames)}`, 15 + `prettier --write ${filenames.join(' ')}`, 16 + ], 17 + 'categories/*.json': (filenames) => [ 18 + `ajv --spec=draft2020 -s category.schema.json ${filenamesToAjvOption(filenames)}`, 19 + `prettier --write ${filenames.join(' ')}`, 20 + ], 21 + }; 22 + 23 + export default config;
+4 -24
package.json
··· 30 30 "generate:nextJSAliases": "node ./scripts/generateNextJSAliases.mjs", 31 31 "postinstall": "husky install", 32 32 "lint:es": "eslint .", 33 + "lint:format": "prettier \"**/*.{js,mjs,ts,jsx,tsx,html,css,scss,json,yml,yaml}\" --write", 33 34 "lint:json:icons": "ajv --spec=draft2020 -s icon.schema.json -d 'icons/*.json' > /dev/null", 34 35 "lint:json:categories": "ajv --spec=draft2020 -s category.schema.json -d 'categories/*.json' > /dev/null", 35 36 "lint:json": "pnpm run lint:json:icons && pnpm run lint:json:categories", 36 - "lint": "pnpm lint:es && pnpm lint:json", 37 + "lint": "pnpm lint:es && pnpm lint:format && pnpm lint:json", 37 38 "prepare": "husky install", 38 39 "gi": "node ./scripts/generate/generateIcons.mjs" 39 40 }, ··· 52 53 "eslint-import-resolver-custom-alias": "^1.3.2", 53 54 "eslint-import-resolver-typescript": "^3.6.1", 54 55 "eslint-plugin-import": "^2.29.1", 55 - "eslint-plugin-prettier": "^4.2.1", 56 56 "husky": "^8.0.3", 57 57 "lint-staged": "^13.3.0", 58 58 "minimist": "^1.2.8", 59 59 "node-fetch": "^3.3.2", 60 60 "p-memoize": "^7.1.1", 61 - "prettier": "2.7.1", 61 + "prettier": "3.1.1", 62 62 "semver": "^7.5.4", 63 63 "simple-git": "^3.21.0", 64 64 "svgo": "^3.1.0", 65 65 "svgson": "^5.3.1" 66 66 }, 67 - "lint-staged": { 68 - "icons/*.svg": [ 69 - "node ./scripts/optimizeStagedSvgs.mjs", 70 - "node ./scripts/generateNextJSAliases.mjs" 71 - ], 72 - "icons/*.json": [ 73 - "ajv --spec=draft2020 -s icon.schema.json -d", 74 - "prettier --write --print-width=0" 75 - ], 76 - "categories/*.json": [ 77 - "ajv --spec=draft2020 -s category.schema.json -d", 78 - "prettier --write --print-width=0" 79 - ] 80 - }, 81 - "packageManager": "pnpm@8.7.1", 67 + "packageManager": "pnpm@8.14.0+sha256.9cebf61abd83f68177b29484da72da9751390eaad46dfc3072d266bfbb1ba7bf", 82 68 "pnpm": { 83 - "peerDependencyRules": { 84 - "ignoreMissing": [ 85 - "@babel/core", 86 - "@babel/preset-env" 87 - ] 88 - }, 89 69 "packageExtensions": { 90 70 "vue-template-compiler": { 91 71 "peerDependencies": {
+1
packages/lucide-angular/.eslintrc.js
··· 8 8 'plugin:@typescript-eslint/recommended', 9 9 'plugin:@angular-eslint/recommended', 10 10 'plugin:@angular-eslint/template/process-inline-templates', 11 + 'prettier', 11 12 ], 12 13 rules: { 13 14 '@angular-eslint/directive-selector': [
-2
packages/lucide-angular/package.json
··· 34 34 "test": "ng test --no-watch --no-progress --browsers=ChromeHeadlessCI", 35 35 "test:watch": "ng test", 36 36 "lint": "npx eslint 'src/**/*.{js,jsx,ts,tsx,html,css,scss}' --quiet --fix", 37 - "format": "npx prettier 'src/**/*.{js,jsx,ts,tsx,html,css,scss}' --write", 38 37 "e2e": "ng e2e", 39 38 "version": "pnpm version --git-tag-version=false" 40 39 }, ··· 59 58 "@typescript-eslint/parser": "5.48.2", 60 59 "eslint": "^8.33.0", 61 60 "eslint-config-prettier": "^8.5.0", 62 - "eslint-plugin-prettier": "^4.2.1", 63 61 "jasmine-core": "~4.0.0", 64 62 "jasmine-spec-reporter": "~7.0.0", 65 63 "karma": "~6.3.0",
+1 -1
packages/lucide-vue/src/createLucideIcon.ts
··· 59 59 return createElement( 60 60 'svg', 61 61 { 62 - // eslint-disable-next-line prettier/prettier 62 + // prettier-ignore 63 63 class: [defaultClass, data.class, data.staticClass, data.attrs && data.attrs.class].filter(Boolean), 64 64 style: [data.style, data.staticStyle, data.attrs && data.attrs.style].filter(Boolean), 65 65 attrs: {
+8 -53
pnpm-lock.yaml
··· 52 52 eslint-plugin-import: 53 53 specifier: ^2.29.1 54 54 version: 2.29.1(@typescript-eslint/parser@6.14.0)(eslint-import-resolver-typescript@3.6.1)(eslint@8.56.0) 55 - eslint-plugin-prettier: 56 - specifier: ^4.2.1 57 - version: 4.2.1(eslint-config-prettier@8.10.0)(eslint@8.56.0)(prettier@2.7.1) 58 55 husky: 59 56 specifier: ^8.0.3 60 57 version: 8.0.3 ··· 71 68 specifier: ^7.1.1 72 69 version: 7.1.1 73 70 prettier: 74 - specifier: 2.7.1 75 - version: 2.7.1 71 + specifier: 3.1.1 72 + version: 3.1.1 76 73 semver: 77 74 specifier: ^7.5.4 78 75 version: 7.5.4 ··· 275 272 eslint-config-prettier: 276 273 specifier: ^8.5.0 277 274 version: 8.10.0(eslint@8.56.0) 278 - eslint-plugin-prettier: 279 - specifier: ^4.2.1 280 - version: 4.2.1(eslint-config-prettier@8.10.0)(eslint@8.56.0)(prettier@2.8.8) 281 275 jasmine-core: 282 276 specifier: ~4.0.0 283 277 version: 4.0.1 ··· 12822 12816 - supports-color 12823 12817 dev: true 12824 12818 12825 - /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0)(eslint@8.56.0)(prettier@2.7.1): 12826 - resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} 12827 - engines: {node: '>=12.0.0'} 12828 - peerDependencies: 12829 - eslint: '>=7.28.0' 12830 - eslint-config-prettier: '*' 12831 - prettier: '>=2.0.0' 12832 - peerDependenciesMeta: 12833 - eslint-config-prettier: 12834 - optional: true 12835 - dependencies: 12836 - eslint: 8.56.0 12837 - eslint-config-prettier: 8.10.0(eslint@8.56.0) 12838 - prettier: 2.7.1 12839 - prettier-linter-helpers: 1.0.0 12840 - dev: true 12841 - 12842 - /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.10.0)(eslint@8.56.0)(prettier@2.8.8): 12843 - resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} 12844 - engines: {node: '>=12.0.0'} 12845 - peerDependencies: 12846 - eslint: '>=7.28.0' 12847 - eslint-config-prettier: '*' 12848 - prettier: '>=2.0.0' 12849 - peerDependenciesMeta: 12850 - eslint-config-prettier: 12851 - optional: true 12852 - dependencies: 12853 - eslint: 8.56.0 12854 - eslint-config-prettier: 8.10.0(eslint@8.56.0) 12855 - prettier: 2.8.8 12856 - prettier-linter-helpers: 1.0.0 12857 - dev: true 12858 - 12859 12819 /eslint-scope@5.1.1: 12860 12820 resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} 12861 12821 engines: {node: '>=8.0.0'} ··· 13203 13163 13204 13164 /fast-deep-equal@3.1.3: 13205 13165 resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} 13206 - dev: true 13207 - 13208 - /fast-diff@1.3.0: 13209 - resolution: {integrity: sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==} 13210 13166 dev: true 13211 13167 13212 13168 /fast-fifo@1.3.2: ··· 18764 18720 engines: {node: '>= 0.8.0'} 18765 18721 dev: true 18766 18722 18767 - /prettier-linter-helpers@1.0.0: 18768 - resolution: {integrity: sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==} 18769 - engines: {node: '>=6.0.0'} 18770 - dependencies: 18771 - fast-diff: 1.3.0 18772 - dev: true 18773 - 18774 18723 /prettier@2.7.1: 18775 18724 resolution: {integrity: sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==} 18776 18725 engines: {node: '>=10.13.0'} ··· 18779 18728 /prettier@2.8.8: 18780 18729 resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} 18781 18730 engines: {node: '>=10.13.0'} 18731 + hasBin: true 18732 + dev: true 18733 + 18734 + /prettier@3.1.1: 18735 + resolution: {integrity: sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==} 18736 + engines: {node: '>=14'} 18782 18737 hasBin: true 18783 18738 dev: true 18784 18739
+16
prettier.config.mjs
··· 1 + /** @satisfies {import('prettier').Config} */ 2 + const config = { 3 + singleQuote: true, 4 + trailingComma: 'all', 5 + printWidth: 100, 6 + overrides: [ 7 + { 8 + files: ['icons/*.json', 'categories/*.json'], 9 + options: { 10 + printWidth: 0, 11 + }, 12 + }, 13 + ], 14 + }; 15 + 16 + export default config;
+4 -4
scripts/generateSuperSVG.mjs
··· 1 1 import path from 'path'; 2 2 import { stringify, parseSync } from 'svgson'; 3 - import prettier from 'prettier'; 3 + import * as prettier from 'prettier'; 4 4 import { appendFile, readSvgDirectory, getCurrentDirPath } from './helpers.mjs'; 5 5 6 6 import readSvgs from '../packages/lucide-static/scripts/readSvgs.mjs'; ··· 10 10 const ICONS_DIR = path.resolve('icons'); 11 11 const PACKAGE_DIR = path.resolve(currentDir); 12 12 13 - export default function generateSprite(svgs, packageDir) { 13 + async function generateSprite(svgs, packageDir) { 14 14 const symbols = svgs.map(({ parsedSvg }, index) => { 15 15 const itemsPerRow = 10; 16 16 const numInRow = index % itemsPerRow; ··· 37 37 }; 38 38 39 39 const spriteSvg = stringify(spriteSvgObject); 40 - const prettifiedSprite = prettier.format(spriteSvg, { parser: 'babel' }).replace(/;/g, ''); 40 + const prettifiedSprite = (await prettier.format(spriteSvg, { parser: 'babel' })).replace(/;/g, ''); 41 41 42 42 const xmlMeta = `<?xml version="1.0" encoding="utf-8"?>\n`; 43 43 ··· 54 54 parsedSvg: parseSync(contents), 55 55 })); 56 56 57 - generateSprite(parsedSvgs, PACKAGE_DIR); 57 + await generateSprite(parsedSvgs, PACKAGE_DIR);
+1 -1
scripts/render/processSvg.mjs
··· 1 1 import {optimize} from 'svgo'; 2 - import prettier from 'prettier'; 2 + import * as prettier from 'prettier'; 3 3 import {parseSync, stringify} from 'svgson'; 4 4 import DEFAULT_ATTRS from './default-attrs.json' assert { type: 'json' }; 5 5