Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>SafeCode ProNew to Visual Studio Code? Get it now.
SafeCode Pro

SafeCode Pro

Durai Raja

|
4 installs
| (0) | Free
Detects unsafe object and array access patterns, null safety issues, and enforces clean variable naming conventions.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

🛡️ SafeCode Pro

SafeCode Pro is a Visual Studio Code extension designed to enhance code safety and enforce naming conventions in JavaScript and JSX code. It detects unsafe object/array usage, missing null checks, and ensures consistent and meaningful naming patterns.


✨ Features

  • ✅ Warns when using Object.keys(data) or other object methods without checking if data is an object via isObject(data)
  • ✅ Highlights unsafe array method calls when the variable may not be an array (e.g., data.map() without Array.isArray(data))
  • ✅ Detects missing null-safe access (e.g., data.name vs data?.name)
  • ✅ Enforces camelCase naming convention
  • ✅ Variable naming rules:
    • o prefix for objects → e.g., oUser
    • a prefix for arrays → e.g., aItems
    • is prefix for booleans → e.g., isValid
    • Functions must start with a verb (e.g., getData, setUser)
    • Setter functions (e.g., from React's useState) must start with set
  • 🧠 Skips commented lines and multi-line comments
  • 🔍 Analyzes line-by-line for performance and clarity

📂 Supported File Types

Language Extensions
JavaScript .js
JavaScript React .jsx

TypeScript support is under consideration.


🧠 Code Safety Examples

❗ Unsafe Object Access

Object.keys(data); // ⛔ unsafe if data is not checked

✅ Use:

if (isObject(data)) {
  Object.keys(data);
}

❗ Unsafe Array Access

data.map(item => item.name); // ⛔ unsafe if data is not an array

✅ Use:

if (Array.isArray(data)) {
  data.map(item => item.name);
}

❗ Unsafe Property Access

const name = data.name; // ⛔ unsafe if data is null/undefined

✅ Use:

const name = data?.name; // ✅ safe access

✅ Naming Conventions

Type Prefix Example
Object o oUserData
Array a aProducts
Boolean is isAvailable
Function Verb-based getInfo, setUser, fetchData
Setter set setUser, setEmail

❌ Invalid:

let UserData = {}; // PascalCase ❌
const infoList = []; // missing array prefix ❌
const valid = true; // no 'is' prefix ❌

✅ Valid:

let oUserData = {};
const aInfoList = [];
const isValid = true;

🚀 Getting Started

Install from VS Code Marketplace:

  1. Open Visual Studio Code
  2. Go to the Extensions Panel
  3. Search for: SafeCode Pro
  4. Click Install

Or install via CLI:

code --install-extension duraidev.safecode-pro

🔧 Configuration

No configuration needed. Works out-of-the-box with .js and .jsx files.


🛠 Planned Features

  • [ ] TypeScript & TSX support
  • [ ] Customizable naming prefixes
  • [ ] Auto-fix suggestions for unsafe patterns
  • [ ] Toggle rules from settings.json

👨‍💻 Author

Built with ❤️ by Durai Raja


📬 Feedback

If you find SafeCode Pro useful, give it a ⭐️ on the Marketplace and share with your dev team!

Issues or suggestions? Feel free to open an issue or contribute!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft