-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add eslint and github actions for lint and build
- Loading branch information
Showing
11 changed files
with
90 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
test/ | ||
public/ | ||
dist/ | ||
global-types.d.ts | ||
*.config.js | ||
*.config.json | ||
*.config.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module.exports = { | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"overrides": [ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
"files": [ | ||
".eslintrc.{js,cjs}" | ||
], | ||
"parserOptions": { | ||
"sourceType": "script" | ||
} | ||
} | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,6 @@ dist-ssr | |
*.sln | ||
*.sw? | ||
package-lock.json | ||
yarn.lock | ||
yarn.lock | ||
results.xml | ||
.jest-stare |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
{ | ||
"name": "stimulus-store", | ||
"private": true, | ||
"version": "0.0.0", | ||
"version": "0.0.1-beta", | ||
"description": "Lightweight state management for Stimulus.js", | ||
"main": "dist/stimulus-store.js", | ||
"scripts": { | ||
"build": "rollup -c --bundleConfigAsCjs", | ||
"test": "jest" | ||
"test": "jest --reporters default jest-stare", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix" | ||
}, | ||
"keywords": [ | ||
"stimulus", | ||
"store" | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@hotwired/stimulus": "^3.2.2", | ||
"@types/jest": "^29.5.10", | ||
"@typescript-eslint/eslint-plugin": "^6.12.0", | ||
"@typescript-eslint/parser": "^6.12.0", | ||
"eslint": "^8.54.0", | ||
"jest": "^29.7.0", | ||
"jest-stare": "^2.5.1", | ||
"prettier": "^3.1.0", | ||
"rollup": "^4.5.1", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"ts-jest": "^29.1.1", | ||
"typescript": "^5.2.2" | ||
} | ||
}, | ||
"jest-stare": { | ||
"resultDir": ".jest-stare" | ||
}, | ||
"private": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":3,"numPassedTests":21,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":3,"numTotalTests":21,"openHandles":[],"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesRemovedList":[],"filesUnmatched":0,"filesUpdated":0,"matched":0,"total":0,"unchecked":0,"uncheckedKeysByFile":[],"unmatched":0,"updated":0},"startTime":1700710936337,"success":true,"testResults":[{"assertionResults":[{"ancestorTitles":["camelize"],"duration":1,"failureDetails":[],"failureMessages":[],"fullName":"camelize should correctly camelize testString","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should correctly camelize testString"},{"ancestorTitles":["camelize"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"camelize should correctly camelize TestString","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should correctly camelize TestString"},{"ancestorTitles":["camelize"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"camelize should correctly camelize testString","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should correctly camelize testString"},{"ancestorTitles":["camelize"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"camelize should correctly camelize TestString","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should correctly camelize TestString"}],"endTime":1700710936966,"message":"","name":"/Users/oluqman/Desktop/dev/stimulus-store/test/camelize.test.ts","startTime":1700710936363,"status":"passed","summary":""},{"assertionResults":[{"ancestorTitles":["useStore"],"duration":1,"failureDetails":[],"failureMessages":[],"fullName":"useStore should subscribe to stores and call update methods on value changes","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should subscribe to stores and call update methods on value changes"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should allow direct access to store values on the controller","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should allow direct access to store values on the controller"},{"ancestorTitles":["useStore"],"duration":1,"failureDetails":[],"failureMessages":[],"fullName":"useStore should allow direct access to store instances on the controller","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should allow direct access to store instances on the controller"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should clean up subscriptions when controller disconnects","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should clean up subscriptions when controller disconnects"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should add a getter for the store value to the controller","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should add a getter for the store value to the controller"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should add a getter for the store instance to the controller","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should add a getter for the store instance to the controller"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should add an update method to the controller","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should add an update method to the controller"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should notify each controller when the shared store's value is updated by any controller","invocations":1,"location":null,"numPassingAsserts":6,"retryReasons":[],"status":"passed","title":"should notify each controller when the shared store's value is updated by any controller"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should call the callback with the current value when a function is passed to set","invocations":1,"location":null,"numPassingAsserts":2,"retryReasons":[],"status":"passed","title":"should call the callback with the current value when a function is passed to set"},{"ancestorTitles":["useStore"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"useStore should update the store's value with the return value of the callback","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should update the store's value with the return value of the callback"}],"endTime":1700710937008,"message":"","name":"/Users/oluqman/Desktop/dev/stimulus-store/test/useStore.test.ts","startTime":1700710936969,"status":"passed","summary":""},{"assertionResults":[{"ancestorTitles":["Store"],"duration":1,"failureDetails":[],"failureMessages":[],"fullName":"Store should initialize with the correct value","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should initialize with the correct value"},{"ancestorTitles":["Store"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"Store should update the value correctly","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should update the value correctly"},{"ancestorTitles":["Store"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"Store should notify subscribers when value changes","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should notify subscribers when value changes"},{"ancestorTitles":["Store"],"duration":1,"failureDetails":[],"failureMessages":[],"fullName":"Store should stop notifying unsubscribed callbacks","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should stop notifying unsubscribed callbacks"},{"ancestorTitles":["Store"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"Store should not notify subscribers when value is the same","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should not notify subscribers when value is the same"},{"ancestorTitles":["Store"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"Store should not notify subscribers when filter returns false","invocations":1,"location":null,"numPassingAsserts":1,"retryReasons":[],"status":"passed","title":"should not notify subscribers when filter returns false"},{"ancestorTitles":["Store"],"duration":0,"failureDetails":[],"failureMessages":[],"fullName":"Store should call the callback with the current value when a function is passed to set","invocations":1,"location":null,"numPassingAsserts":2,"retryReasons":[],"status":"passed","title":"should call the callback with the current value when a function is passed to set"}],"endTime":1700710937052,"message":"","name":"/Users/oluqman/Desktop/dev/stimulus-store/test/store.test.ts","startTime":1700710937015,"status":"passed","summary":""}],"wasInterrupted":false} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import type { Controller } from "@hotwired/stimulus" | ||
import type { Store } from './store'; | ||
|
||
export interface StoreController extends Controller { | ||
export interface StoreController<T> extends Controller { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
[key: string]: any; | ||
constructor: { | ||
stores?: Store<any>[]; | ||
stores?: Store<T>[]; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters