
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@ioffice/tslint-config-ioffice
Advanced tools
1.1 Remove them. To prevent them make sure to use noUnusedParameters
in your
tsconfig.json
file.
// bad
function foo(a, b, c) {
return a + b;
}
// good
function foo(a, b) {
return a + b;
}
2.1 When you must use function expressions (as when passing an anonymous function), use arrow function notation.
// bad
[1, 2, 3].map(function (x) {
const y = x + 1;
return x * y;
});
// good
[1, 2, 3].map((x) => {
const y = x + 1;
return x * y;
});
// good
[0, null, 1, null, 2].filter(x => x !== null);
3.1 Use braces with all multi-line blocks.
// bad
if (test)
return false;
// good
if (test) return false;
// good
if (test) {
return false;
}
// bad
function foo() { return false; }
// good
function bar() {
return false;
}
3.2 If you're using multi-line blocks with if
and else
, put else
on the same line as
your if
block's closing brace.
// bad
if (test) {
thing1();
thing2();
}
else {
thing3();
}
// good
if (test) {
thing1();
thing2();
} else {
thing3();
}
4.1 Use soft tabs set to 2 spaces.
// bad
function foo() {
const name;
}
// bad
function bar() {
const name;
}
// good
function baz() {
const name;
}
4.2 Add spaces inside curly braces.
// bad
const foo = {clark: 'kent'};
// good
const foo = { clark: 'kent' };
5.1 Leading commas: Nope.
// bad
const story = [
once
, upon
, aTime
];
// good
const story = [
once,
upon,
aTime,
];
// bad
const hero = {
firstName: 'Ada'
, lastName: 'Lovelace'
, birthYear: 1815
, superPower: 'computers'
};
// good
const hero = {
firstName: 'Ada',
lastName: 'Lovelace',
birthYear: 1815,
superPower: 'computers',
};
6.1 Always use modules (import
/export
) over a non-standard module system. You can always
transpile to your preferred module system.
// bad
const iOfficeStyleGuide = require('./iOfficeStyleGuide');
module.exports = iOfficeStyleGuide.ts;
// ok
import * as iOfficeStyleGuide from './iOfficeStyleGuide';
const ts = iOfficeStyleGuide.ts;
export {
ts,
};
// best
import { ts } from './iOfficeStyleGuide';
export {
ts,
};
6.2 Do not use default exports. Use a single named export
which declares all the classes,
functions, objects and interfaces that the module is exporting.
// bad
export class A {}
export class B {}
export default A;
// good
class C {}
class D {}
export {
C,
D,
};
// bad
export default function() {
}
// good
function A() {
}
export { A };
// good
function A() {
}
export { A };
FAQs
IOFFICE TypeScript Style Guide
We found that @ioffice/tslint-config-ioffice demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.