From e59958a72f6dabb61d7b5db6446e7130032467fb Mon Sep 17 00:00:00 2001 From: Niko Kangas Date: Thu, 25 Jun 2026 11:54:27 +0200 Subject: [PATCH] init --- .forceignore | 14 +++++++++ .husky/pre-commit | 1 + .prettierignore | 11 +++++++ .prettierrc | 17 ++++++++++ .vscode/extensions.json | 9 ++++++ .vscode/launch.json | 16 ++++++++++ .vscode/settings.json | 8 +++++ config/project-scratch-def.json | 46 +++++++++++++++++++++++++++ config/user-def.json | 15 +++++++++ eslint.config.js | 55 +++++++++++++++++++++++++++++++++ jest.config.js | 6 ++++ package.json | 44 ++++++++++++++++++++++++++ scripts/apex/hello.apex | 10 ++++++ scripts/soql/account.soql | 6 ++++ sfdx-project.json | 12 +++++++ 15 files changed, 270 insertions(+) create mode 100644 .forceignore create mode 100644 .husky/pre-commit create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 config/project-scratch-def.json create mode 100644 config/user-def.json create mode 100644 eslint.config.js create mode 100644 jest.config.js create mode 100644 package.json create mode 100644 scripts/apex/hello.apex create mode 100644 scripts/soql/account.soql create mode 100644 sfdx-project.json diff --git a/.forceignore b/.forceignore new file mode 100644 index 0000000..d87304a --- /dev/null +++ b/.forceignore @@ -0,0 +1,14 @@ +# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status +# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm +# + +package.xml + +# LWC configuration files +**/jsconfig.json +**/.eslintrc.json + +# LWC Jest +**/__tests__/** + +node_modules/ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..2601a3b --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm run precommit \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..8cccc6e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +# List files or directories below to ignore them when running prettier +# More information: https://prettier.io/docs/en/ignore.html +# + +**/staticresources/** +.localdevserver +.sfdx +.sf +.vscode + +coverage/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..18039a0 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,17 @@ +{ + "trailingComma": "none", + "plugins": [ + "prettier-plugin-apex", + "@prettier/plugin-xml" + ], + "overrides": [ + { + "files": "**/lwc/**/*.html", + "options": { "parser": "lwc" } + }, + { + "files": "*.{cmp,page,component}", + "options": { "parser": "html" } + } + ] +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..7e6cb10 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "salesforce.salesforcedx-vscode", + "redhat.vscode-xml", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "financialforce.lana" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e07e391 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Apex Replay Debugger", + "type": "apex-replay", + "request": "launch", + "logFile": "${command:AskForLogFileName}", + "stopOnEntry": true, + "trace": true + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4226af2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "search.exclude": { + "**/node_modules": true, + "**/bower_components": true, + "**/.sf": true, + "**/.sfdx": true + } +} diff --git a/config/project-scratch-def.json b/config/project-scratch-def.json new file mode 100644 index 0000000..0393004 --- /dev/null +++ b/config/project-scratch-def.json @@ -0,0 +1,46 @@ +{ + "orgName": "devSandbox sc", + "edition": "Developer", + "hasSampleData": false, + "username": "niko_apis+19526@pm.me", + "language": "en_US", + "features": [ + "Communities", + "ContactsToMultipleAccounts", + "Einstein1AIPlatform", + "EnableSetPasswordInApi", + "ServiceCloud", + "Sites" + ], + "settings": { + "caseSettings": { + "systemUserEmail": "niko_apis@pm.me" + }, + "communitiesSettings": { + "enableNetworksEnabled": true, + "enableOotbProfExtUserOpsEnable": true + }, + "customAddressFieldSettings": { + "enableCustomAddressField": true + }, + "experienceBundleSettings": { + "enableExperienceBundleMetadata": true + }, + "lightningExperienceSettings": { + "enableS1DesktopEnabled": true, + "enableLightningPreviewPref": true + }, + "mobileSettings": { + "enableS1EncryptedStoragePref2": true + }, + "agentPlatformSettings": { + "enableAgentPlatform": true + }, + "einsteinGptSettings": { + "enableEinsteinGptPlatform": true + }, + "userManagementSettings": { + "enableNewProfileUI": true + } + } +} \ No newline at end of file diff --git a/config/user-def.json b/config/user-def.json new file mode 100644 index 0000000..f8c304b --- /dev/null +++ b/config/user-def.json @@ -0,0 +1,15 @@ +{ + "Username": "tester1@sfdx.org", + "LastName": "Hobbs", + "Email": "niko_apis@pm.me", + "Alias": "tester1", + "TimeZoneSidKey": "Europe/Stockholm", + "LocaleSidKey": "en_US", + "EmailEncodingKey": "UTF-8", + "LanguageLocaleKey": "en_US", + "profileName": "System Administrator", + //"permsets": ["Dreamhouse", "Cloudhouse"], + "generatePassword": true, + "roleDeveloperName": "Customer_Support", + "generatePassword": true +} \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..a58c917 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,55 @@ +const { defineConfig } = require('eslint/config'); +const eslintJs = require('@eslint/js'); +const jestPlugin = require('eslint-plugin-jest'); +const auraConfig = require('@salesforce/eslint-plugin-aura'); +const lwcConfig = require('@salesforce/eslint-config-lwc/recommended'); +const globals = require('globals'); + +module.exports = defineConfig([ + // Aura configuration + { + files: ['**/aura/**/*.js'], + extends: [ + ...auraConfig.configs.recommended, + ...auraConfig.configs.locker + ] + }, + + // LWC configuration + { + files: ['**/lwc/**/*.js'], + extends: [lwcConfig] + }, + + // LWC configuration with override for LWC test files + { + files: ['**/lwc/**/*.test.js'], + extends: [lwcConfig], + rules: { + '@lwc/lwc/no-unexpected-wire-adapter-usages': 'off' + }, + languageOptions: { + globals: { + ...globals.node + } + } + }, + + // Jest mocks configuration + { + files: ['**/jest-mocks/**/*.js'], + languageOptions: { + sourceType: 'module', + ecmaVersion: 'latest', + globals: { + ...globals.node, + ...globals.es2021, + ...jestPlugin.environments.globals.globals + } + }, + plugins: { + eslintJs + }, + extends: ['eslintJs/recommended'] + } +]); \ No newline at end of file diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..f5a9fed --- /dev/null +++ b/jest.config.js @@ -0,0 +1,6 @@ +const { jestConfig } = require('@salesforce/sfdx-lwc-jest/config'); + +module.exports = { + ...jestConfig, + modulePathIgnorePatterns: ['/.localdevserver'] +}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..0d77cdc --- /dev/null +++ b/package.json @@ -0,0 +1,44 @@ +{ + "name": "salesforce-app", + "private": true, + "version": "1.0.0", + "description": "Salesforce App", + "scripts": { + "lint": "eslint **/{aura,lwc}/**/*.js", + "test": "npm run test:unit", + "test:unit": "sfdx-lwc-jest", + "test:unit:watch": "sfdx-lwc-jest --watch", + "test:unit:debug": "sfdx-lwc-jest --debug", + "test:unit:coverage": "sfdx-lwc-jest --coverage", + "prettier": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "prettier:verify": "prettier --check \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"", + "prepare": "husky || true", + "precommit": "lint-staged" + }, + "devDependencies": { + "@lwc/eslint-plugin-lwc": "^3.1.0", + "@prettier/plugin-xml": "^3.4.1", + "@salesforce/eslint-config-lwc": "^4.0.0", + "@salesforce/eslint-plugin-aura": "^3.0.0", + "@salesforce/eslint-plugin-lightning": "^2.0.0", + "@salesforce/sfdx-lwc-jest": "^7.0.2", + "eslint": "^9.29.0", + "eslint-plugin-import": "^2.31.0", + "eslint-plugin-jest": "^28.14.0", + "husky": "^9.1.7", + "lint-staged": "^16.1.2", + "prettier": "^3.5.3", + "prettier-plugin-apex": "^2.2.6" + }, + "lint-staged": { + "**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}": [ + "prettier --write" + ], + "**/{aura,lwc}/**/*.js": [ + "eslint" + ], + "**/lwc/**": [ + "sfdx-lwc-jest -- --bail --findRelatedTests --passWithNoTests" + ] + } +} diff --git a/scripts/apex/hello.apex b/scripts/apex/hello.apex new file mode 100644 index 0000000..1fba732 --- /dev/null +++ b/scripts/apex/hello.apex @@ -0,0 +1,10 @@ +// Use .apex files to store anonymous Apex. +// You can execute anonymous Apex in VS Code by selecting the +// apex text and running the command: +// SFDX: Execute Anonymous Apex with Currently Selected Text +// You can also execute the entire file by running the command: +// SFDX: Execute Anonymous Apex with Editor Contents + +string tempvar = 'Enter_your_name_here'; +System.debug('Hello World!'); +System.debug('My name is ' + tempvar); \ No newline at end of file diff --git a/scripts/soql/account.soql b/scripts/soql/account.soql new file mode 100644 index 0000000..10d4b9c --- /dev/null +++ b/scripts/soql/account.soql @@ -0,0 +1,6 @@ +// Use .soql files to store SOQL queries. +// You can execute queries in VS Code by selecting the +// query text and running the command: +// SFDX: Execute SOQL Query with Currently Selected Text + +SELECT Id, Name FROM Account diff --git a/sfdx-project.json b/sfdx-project.json new file mode 100644 index 0000000..38261e0 --- /dev/null +++ b/sfdx-project.json @@ -0,0 +1,12 @@ +{ + "packageDirectories": [ + { + "path": "force-app", + "default": true + } + ], + "name": "devai", + "namespace": "", + "sfdcLoginUrl": "https://login.salesforce.com", + "sourceApiVersion": "67.0" +}