diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 8af734d..0000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-env node */ - -/** - * @type {import("eslint").ESLint.ConfigData} - */ -module.exports = { - extends: [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:@typescript-eslint/recommended-type-checked", - "prettier", - ], - ignorePatterns: ["*.cjs", "*.js", "*.d.ts", "vite.config.ts", "*.test.ts"], - parser: "@typescript-eslint/parser", - parserOptions: { - tsconfigRootDir: __dirname, - project: ["./tsconfig.json", "./tools/tsconfig.json"], - }, - plugins: ["@typescript-eslint"], - root: true, - rules: { - "require-await": "error", - "no-return-await": "warn", - }, - }; - \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3323939 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,347 @@ +# Common settings that generally should always be used with your language specific settings + +# Auto detect text files and perform LF normalization +* text=auto + +# +# The above will handle all files NOT found below +# + +# Documents +*.bibtex text diff=bibtex +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain +*.md text diff=markdown +*.mdx text diff=markdown +*.tex text diff=tex +*.adoc text +*.textile text +*.mustache text +*.csv text eol=crlf +*.tab text +*.tsv text +*.txt text +*.sql text +*.epub diff=astextplain + +# Graphics +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.tif binary +*.tiff binary +*.ico binary +# SVG treated as text by default. +*.svg text +# If you want to treat it as binary, +# use the following line instead. +# *.svg binary +*.eps binary + +# Scripts +*.bash text eol=lf +*.fish text eol=lf +*.ksh text eol=lf +*.sh text eol=lf +*.zsh text eol=lf +# These are explicitly windows files and should use crlf +*.bat text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf + +# Serialisation +*.json text +*.toml text +*.xml text +*.yaml text +*.yml text + +# Archives +*.7z binary +*.bz binary +*.bz2 binary +*.bzip2 binary +*.gz binary +*.lz binary +*.lzma binary +*.rar binary +*.tar binary +*.taz binary +*.tbz binary +*.tbz2 binary +*.tgz binary +*.tlz binary +*.txz binary +*.xz binary +*.Z binary +*.zip binary +*.zst binary + +# Text files where line endings should be preserved +*.patch -text + +# +# Exclude files from exporting +# + +.gitattributes export-ignore +.gitignore export-ignore +.gitkeep export-ignore + +# Apply override to all files in the directory +*.md linguist-detectable + + +# Basic .gitattributes for a Microsoft Shell repo. + +# Source files +# ============ +*.msh text eol=crlf +*.msh1 text eol=crlf +*.msh2 text eol=crlf +*.mshxml text eol=crlf +*.msh1xml text eol=crlf +*.msh2xml text eol=crlf +*.mcf text eol=crlf + +# Basic .gitattributes for a PowerShell repo. + +# Source files +# ============ +*.ps1 text eol=crlf +*.ps1x text eol=crlf +*.psm1 text eol=crlf +*.psd1 text eol=crlf +*.ps1xml text eol=crlf +*.pssc text eol=crlf +*.psrc text eol=crlf +*.cdxml text eol=crlf + +## GITATTRIBUTES FOR WEB PROJECTS +# +# These settings are for any web project. +# +# Details per file setting: +# text These files should be normalized (i.e. convert CRLF to LF). +# binary These files are binary and should be left untouched. +# +# Note that binary is a macro for -text -diff. +###################################################################### + +# Auto detect +## Handle line endings automatically for files detected as +## text and leave all files detected as binary untouched. +## This will handle all files NOT defined below. +* text=auto + +# Source code +*.bash text eol=lf +*.bat text eol=crlf +*.cmd text eol=crlf +*.coffee text +*.css text diff=css +*.htm text diff=html +*.html text diff=html +*.inc text +*.ini text +*.js text +*.mjs text +*.cjs text +*.json text +*.jsx text +*.less text +*.ls text +*.map text -diff +*.od text +*.onlydata text +*.php text diff=php +*.pl text +*.ps1 text eol=crlf +*.py text diff=python +*.rb text diff=ruby +*.sass text +*.scm text +*.scss text diff=css +*.sh text eol=lf +.husky/* text eol=lf +*.sql text +*.styl text +*.tag text +*.ts text +*.tsx text +*.xml text +*.xhtml text diff=html + +# Docker +Dockerfile text + +# Documentation +*.ipynb text eol=lf +*.markdown text diff=markdown +*.md text diff=markdown +*.mdwn text diff=markdown +*.mdown text diff=markdown +*.mkd text diff=markdown +*.mkdn text diff=markdown +*.mdtxt text +*.mdtext text +*.txt text +AUTHORS text +CHANGELOG text +CHANGES text +CONTRIBUTING text +COPYING text +copyright text +*COPYRIGHT* text +INSTALL text +license text +LICENSE text +NEWS text +readme text +*README* text +TODO text + +# Templates +*.dot text +*.ejs text +*.erb text +*.haml text +*.handlebars text +*.hbs text +*.hbt text +*.jade text +*.latte text +*.mustache text +*.njk text +*.phtml text +*.svelte text +*.tmpl text +*.tpl text +*.twig text +*.vue text + +# Configs +*.cnf text +*.conf text +*.config text +.editorconfig text +.env text +.gitattributes text +.gitconfig text +.htaccess text +*.lock text -diff +package.json text eol=lf +package-lock.json text eol=lf -diff +pnpm-lock.yaml text eol=lf -diff +.prettierrc text +yarn.lock text -diff +*.toml text +*.yaml text +*.yml text +browserslist text +Makefile text +makefile text +# Fixes syntax highlighting on GitHub to allow comments +tsconfig.json linguist-language=JSON-with-Comments + +# Heroku +Procfile text + +# Graphics +*.ai binary +*.bmp binary +*.eps binary +*.gif binary +*.gifv binary +*.ico binary +*.jng binary +*.jp2 binary +*.jpg binary +*.jpeg binary +*.jpx binary +*.jxr binary +*.pdf binary +*.png binary +*.psb binary +*.psd binary +# SVG treated as an asset (binary) by default. +*.svg text +# If you want to treat it as binary, +# use the following line instead. +# *.svg binary +*.svgz binary +*.tif binary +*.tiff binary +*.wbmp binary +*.webp binary + +# Audio +*.kar binary +*.m4a binary +*.mid binary +*.midi binary +*.mp3 binary +*.ogg binary +*.ra binary + +# Video +*.3gpp binary +*.3gp binary +*.as binary +*.asf binary +*.asx binary +*.avi binary +*.fla binary +*.flv binary +*.m4v binary +*.mng binary +*.mov binary +*.mp4 binary +*.mpeg binary +*.mpg binary +*.ogv binary +*.swc binary +*.swf binary +*.webm binary + +# Archives +*.7z binary +*.gz binary +*.jar binary +*.rar binary +*.tar binary +*.zip binary + +# Fonts +*.ttf binary +*.eot binary +*.otf binary +*.woff binary +*.woff2 binary + +# Executables +*.exe binary +*.pyc binary +# Prevents massive diffs caused by vendored, minified files +**/.yarn/releases/** binary +**/.yarn/plugins/** binary + +# RC files (like .babelrc or .eslintrc) +*.*rc text + +# Ignore files (like .npmignore or .gitignore) +*.*ignore text + +# Prevents massive diffs from built files +dist/* binary + +*.lockb binary diff=lockb diff --git a/.gitignore b/.gitignore index be3dbd8..c48a591 100644 --- a/.gitignore +++ b/.gitignore @@ -192,4 +192,6 @@ $RECYCLE.BIN/ # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) deleteme* -*.mjs \ No newline at end of file +*.mjs + +.gitattributes.new \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index e383372..fa1fea8 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,4 +1,7 @@ package.json package-lock.json +*.lockb .prettierignore -.eslintrc.json \ No newline at end of file +.eslintrc.json +tsconfig.json +tsconfig.*.json diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 0000000..0b6f3c7 --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,9 @@ +// prettier.config.js, .prettierrc.js, prettier.config.mjs, or .prettierrc.mjs + +/** @type {import("prettier").Config} */ +const config = { + plugins: ["@trivago/prettier-plugin-sort-imports"], + endOfLine: "auto", +}; + +export default config; diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d954c6a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "eslint.useFlatConfig": true, + "eslint.useESLintClass": true +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6e077c8..38ef955 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,78 +1,70 @@ { - "version": "2.0.0", - "tasks": [ - { - "type": "npm", - "script": "build", - "group": { - "kind": "build", - "isDefault": true - }, - "icon": { - "id": "tools", - "color": "terminal.ansiGreen" - }, - "problemMatcher": [ - "$tsc" - ], - "label": "Build", - "detail": "Builds the project for production" - }, - { - "type": "npm", - "script": "dev", - "problemMatcher": [ - "$tsc-watch" - ], - "icon": { - "id": "eye-watch", - "color": "terminal.ansiCyan" - }, - "group": "build", - "label": "Watch using Vite dev mode", - "detail": "vite" - }, - { - "type": "npm", - "script": "deploy", - "label": "Deploy", - "detail": "Deploys the page to GitHub Pages of this repository.", - "icon": { - "id": "github-inverted", - "color": "terminal.ansiRed" - }, - "problemMatcher": [], - "presentation": { - "echo": true, - "reveal": "always", - "focus": false, - "panel": "dedicated", - "showReuseMessage": true, - "clear": true - } - }, - { - "type": "npm", - "script": "preview", - "group": "build", - "icon": { - "id": "preview", - "color": "terminal.ansiGreen" - }, - "problemMatcher": [ - "$tsc" - ], - "label": "Preview production", - "detail": "Perform Vite production build and then preview it." - }, - { - "type": "npm", - "script": "lint:eslint", - "problemMatcher": [ - "$eslint-compact" - ], - "label": "npm: lint:eslint", - "detail": "eslint . --fix" - } - ] -} \ No newline at end of file + "version": "2.0.0", + "tasks": [ + { + "type": "npm", + "script": "build", + "group": { + "kind": "build", + "isDefault": true + }, + "icon": { + "id": "tools", + "color": "terminal.ansiGreen" + }, + "problemMatcher": ["$tsc"], + "label": "Build", + "detail": "Builds the project for production" + }, + { + "type": "npm", + "script": "dev", + "problemMatcher": ["$tsc-watch"], + "icon": { + "id": "eye-watch", + "color": "terminal.ansiCyan" + }, + "group": "build", + "label": "Watch using Vite dev mode", + "detail": "vite" + }, + { + "type": "npm", + "script": "deploy", + "label": "Deploy", + "detail": "Deploys the page to GitHub Pages of this repository.", + "icon": { + "id": "github-inverted", + "color": "terminal.ansiRed" + }, + "problemMatcher": [], + "presentation": { + "echo": true, + "reveal": "always", + "focus": false, + "panel": "dedicated", + "showReuseMessage": true, + "clear": true + } + }, + { + "type": "npm", + "script": "preview", + "group": "build", + "icon": { + "id": "preview", + "color": "terminal.ansiGreen" + }, + "problemMatcher": ["$tsc"], + "label": "Preview production", + "detail": "Perform Vite production build and then preview it." + }, + { + "type": "npm", + "script": "lint:eslint", + "problemMatcher": ["$eslint-compact"], + "label": "npm: lint:eslint", + "detail": "eslint . --fix" + } + ] +} diff --git a/README.md b/README.md index aeab8b9..bb82291 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ This is a starter application for creating a single page map application using the [ArcGIS Maps SDK for JavaScript], which is built using [Vite] and [TypeScript]. -[Vite]:https://vitejs.dev/ -[TypeScript]:https://www.typescriptlang.org/ -[ArcGIS Maps SDK for JavaScript]:https://developers.arcgis.com/javascript/latest/ +[Vite]: https://vitejs.dev/ +[TypeScript]: https://www.typescriptlang.org/ +[ArcGIS Maps SDK for JavaScript]: https://developers.arcgis.com/javascript/latest/ ## Use @@ -19,9 +19,9 @@ More information about templates can be found in this [GitHub blog: Generate new 1. Clone this repository to your computer's hard drive. 2. Remove the remote repository - ```cmd - git remote remove origin - ``` + ```cmd + git remote remove origin + ``` 3. Update the information in the `package.json` file with your own project's information. 4. Add your remote using the `git remote` command. diff --git a/bun.lockb b/bun.lockb new file mode 100644 index 0000000..bbcacf3 Binary files /dev/null and b/bun.lockb differ diff --git a/bunfig.toml b/bunfig.toml new file mode 100644 index 0000000..e69de29 diff --git a/cspell.json b/cspell.json index 35f9660..a80dc27 100644 --- a/cspell.json +++ b/cspell.json @@ -1,28 +1,23 @@ { - "version": "0.2", - "allowCompoundWords": true, - "useGitignore": true, - "ignorePaths": [ - "**/tsconfig.json" - ], - "dictionaryDefinitions": [ - { - "name": "custom-dictionary", - "path": "./.cspell/custom-dictionary.txt", - "addWords": true - }, - { - "name": "field-names-dictionary", - "path": "./.cspell/field-names-dictionary.txt", - "addWords": true, - "description": "This dictionary is used for map service field names." - } - ], - "dictionaries": [ - "custom-dictionary", - "field-names-dictionary" - ], - "words": [], - "ignoreWords": [], - "import": [] + "version": "0.2", + "allowCompoundWords": true, + "useGitignore": true, + "ignorePaths": ["**/tsconfig.json"], + "dictionaryDefinitions": [ + { + "name": "custom-dictionary", + "path": "./.cspell/custom-dictionary.txt", + "addWords": true + }, + { + "name": "field-names-dictionary", + "path": "./.cspell/field-names-dictionary.txt", + "addWords": true, + "description": "This dictionary is used for map service field names." + } + ], + "dictionaries": ["custom-dictionary", "field-names-dictionary"], + "words": [], + "ignoreWords": [], + "import": [] } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..884f544 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,66 @@ +// @ts-check +import eslint from "@eslint/js"; +import gitignore from "eslint-config-flat-gitignore"; +import eslintConfigPrettier from "eslint-config-prettier"; +import jsdoc from "eslint-plugin-jsdoc"; +import tseslint from "typescript-eslint"; + +export default tseslint.config( + gitignore({ + root: true, + }), + { + files: ["{src,tests,tools}/**/*.{ts,tsx,mts}"], + ignores: ["vite.config.ts"], + plugins: { + "@typescript-eslint": tseslint.plugin, + jsdoc, + }, + extends: [ + gitignore(), + eslint.configs.recommended, + ...tseslint.configs.strictTypeChecked, + ...tseslint.configs.stylisticTypeChecked, + jsdoc.configs["flat/recommended-typescript"], + eslintConfigPrettier, + ], + languageOptions: { + parserOptions: { + project: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + "jsdoc/require-jsdoc": [ + "warn", + { + enableFixer: false, + publicOnly: true, + }, + ], + "@typescript-eslint/no-unnecessary-condition": "warn", + "@typescript-eslint/restrict-template-expressions": [ + "error", + { + allowAny: false, + allowBoolean: true, + allowNullish: true, + allowNumber: true, + allowRegExp: true, + }, + ], + }, + }, + { + files: ["{src,tests,tools}/**/*.{js,jsx,mjs}"], + extends: [tseslint.configs.disableTypeChecked], + rules: { + // turn off other type-aware rules + "deprecation/deprecation": "off", + "@typescript-eslint/internal/no-poorly-typed-ts-props": "off", + + // turn off rules that don't apply to JS code + "@typescript-eslint/explicit-function-return-type": "off", + }, + }, +); diff --git a/index.html b/index.html index 1a29134..3309fee 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,16 @@ - +
- - - + + +