![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@agoda-com/tslint-rules
Advanced tools
A set of additional TSLint rules used on some Agoda projects.
yarn add -D @agoda-com/tslint-rules
Change your tslint.json
file to extend the rules:
"extends": [
"tslint:recommended",
"tslint-react",
"@agoda-com/tslint-rules"
],
and explicity turn on desired rules (all are off by default)
do-not-use
Prints out a warning, that this function / method should not be used, and should get refactored if possible
A list of banned functions or methods in the following format:
"functionName"
["functionName"]
{"name": "functionName", "message": "optional explanation message"}
["functionName", "methodName", "optional message"]
{"name": ["objectName", "methodName"], "message": "optional message"}
{"name": ["foo", "bar", "baz"]}
bans foo.bar.baz()
*
) that matches everything. {"name": ["*", "forEach"]}
bans
[].forEach(...)
, $(...).forEach(...)
, arr.forEach(...)
, etc.Example:
[].forEach(e => doSomething()); // -> not allowed
Example usage:
"do-not-use": [
true,
{name: ["*", "forEach"], message: "Please refactor and use regular loops instead"},
],
root-relative-imports
Prevents traversing upwards in directory structure when importing files, forcing the use of root relative imports instead.
Example:
import { MyComponent } from './MyComponent'; // -> allowed
import { MyComponent } from './Child/MyComponent'; // -> allowed
import { MyComponent } from 'components/MyComponent'; // -> allowed
import { MyComponent } from '../components/MyComponent'; // -> not allowed
Example usage:
"root-relative-imports": true,
disallowed-in-tests
Prints out a warning, that this CallExpression should not be used in the TEST files, and should get refactored if possible.
name of the call expression you want to ban in the test files.
"object.method"
warning message you would like to give to the particular callExpression.
Example:
//myFile.test.tsx
it('all elements are loaded correctly', (done) => {
const wrapper = mount(<SomeComponent {...someComponentParams} />);
// not allowed
setTimeout(
() => {
expect(...)
}, 0);
});
Example usage:
{
"disallowed-in-tests": [
true,
{"name": "setTimeout", "message": "no setTimeout allow in test files"}
]
}
no-mount-and-snapshot
Prints out a warning, that you should not be using mount
and toMatchSnapshot
in the same test case.
Example
//myFile.test.tsx
// not allowed
it('all elements are loaded correctly', () => {
const wrapper = mount(<SomeComponent {...someComponentParams} />);
expect(enzymeToJson(wrapper)).toMatchSnapshot();
});
// allowed
it('all elements are loaded correctly', () => {
const wrapper = shallow(<SomeComponent {...someComponentParams} />);
expect(enzymeToJson(wrapper)).toMatchSnapshot();
});
// allowed
it('all elements are loaded correctly', () => {
const wrapper = mount(<SomeComponent {...someComponentParams} />);
expect(wrapper.find(myComponent).length).toBe(1);;
});
Example usage:
"no-mount-and-snapshot": true,
no-triple-equals-null
Prints out a warning, that you should not be using tripple equals with null (and optionaly undefined). Supports auto fix.
Example
//myFile.test.tsx
// not allowed
const x = "" === null;
// not allowed
const x = "" !== null;
// allowed
const x = "" === undefined;
/**
* with option "no-undefined-check"
*/
// not allowed
const x = "" === undefined;
// not allowed
const x = "" !== undefined;
// not allowed
const x = "" == undefined;
// not allowed
const x = "" != undefined;
Example usage:
"no-triple-equals-null": [true, "no-undefined-check"]
FAQs
A set of TSLint rules used on some Agoda projects.
The npm package @agoda-com/tslint-rules receives a total of 1 weekly downloads. As such, @agoda-com/tslint-rules popularity was classified as not popular.
We found that @agoda-com/tslint-rules demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.