mirror of
https://github.com/Screenly/Anthias.git
synced 2025-12-23 22:38:05 -05:00
chore: write new Cursor rules for React and Redux
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
- CoffeeScript is used for front-end code, which gets transpiled to JavaScript.
|
||||
- See [anthias.coffee](mdc:static/js/anthias.coffee) and [settings.coffee](mdc:static/js/settings.coffee) for details.
|
||||
- Backbone.js is used as the front-end framework.
|
||||
- CoffeeScript and Backbone.js will be deprecated in favor of modern frameworks
|
||||
that are more stable and still maintained.
|
||||
- Anthias uses JavaScript and React for the front-end framework.
|
||||
- We use Prettier for formatting and ESLint for linting. Check `README.md` for docs
|
||||
on how to run them.
|
||||
- Make sure that generated code conforms to the project's coding standards.
|
||||
- Reorganize imports to follow the project's coding standards. Order imports
|
||||
alphabetically and group imports by type. Imports must be declared in the
|
||||
following order:
|
||||
- Built-in imports
|
||||
- Third-party imports
|
||||
- Imports from other files in the project
|
||||
- Separate import groups with blank lines.
|
||||
|
||||
15
.cursor/rules/react.mdc
Normal file
15
.cursor/rules/react.mdc
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# React
|
||||
|
||||
- Make use of functional components instead of class-based components.
|
||||
- Use `useState` for managing state instead of `this.state`.
|
||||
- Use `useEffect` for managing side effects instead of `componentDidMount`,
|
||||
`componentDidUpdate`, and `componentWillUnmount`.
|
||||
- Do not explicitly import React from `react`, as it is already being taken care
|
||||
of by the `new webpack.ProvidePlugin({ React: 'react' })` plugin in
|
||||
`webpack.common.js`.
|
||||
- Avoid props drilling by using Redux for state management.
|
||||
14
.cursor/rules/redux.mdc
Normal file
14
.cursor/rules/redux.mdc
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
description:
|
||||
globs:
|
||||
alwaysApply: true
|
||||
---
|
||||
# Redux
|
||||
|
||||
- Redux is used for state management.
|
||||
- Use `createSlice` to create new slices.
|
||||
- Use `createAsyncThunk` to create new async thunks.
|
||||
- Resort to storing new states in the Redux in cases where you need to share
|
||||
data between components that are not directly related.
|
||||
- Asset-related states (e.g., asset creation, asset update, etc.) must be stored
|
||||
in the Redux store.
|
||||
Reference in New Issue
Block a user