-
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.
- Loading branch information
Showing
9 changed files
with
374 additions
and
1,927 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
name: "ESBuild Testing" | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
eslint: | ||
name: Run esbuild | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Dependencies | ||
run: npm prune | ||
|
||
- name: Run ESBuild | ||
run: npm run test:minify | ||
continue-on-error: 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
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,31 @@ | ||
from gpiozero import MotionSensor | ||
from signal import pause | ||
import argparse, sys | ||
|
||
parser = argparse.ArgumentParser( | ||
description='Read MotionSensor state from GPIO for EXT-Pir', | ||
epilog="Support: https://forum.bugsounet.fr ©bugsounet 2024" | ||
) | ||
|
||
def gpio_check(x): | ||
x = int(x) | ||
if x < 1 or x > 21: | ||
raise argparse.ArgumentTypeError("GPIO must be between 1 and 21") | ||
return x | ||
|
||
parser.add_argument("-g", "--gpio", help="Define GPIO", type=gpio_check, required=True) | ||
|
||
args = parser.parse_args(None if sys.argv[1:] else ['-h']) | ||
|
||
GPIO = "GPIO" + str(args.gpio) | ||
|
||
def detected(): | ||
print('Detected') | ||
|
||
try: | ||
pir = MotionSensor(GPIO) | ||
pir.when_motion = detected | ||
pause() | ||
except Exception as e: | ||
print("Error:", e) | ||
|
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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
const globals = require("globals"); | ||
const { configs: eslintConfigs } = require("@eslint/js"); | ||
const eslintPluginImport = require("eslint-plugin-import"); | ||
const eslintPluginStylistic = require("@stylistic/eslint-plugin"); | ||
|
||
const config = [ | ||
{ | ||
files: ["**/*.js"], | ||
languageOptions: { | ||
globals: { | ||
...globals.browser, | ||
...globals.node, | ||
config: true, | ||
Log: true, | ||
MM: true, | ||
Module: true, | ||
moment: true, | ||
document: true, | ||
windows: true, | ||
configMerge: true | ||
} | ||
}, | ||
plugins: { | ||
...eslintPluginStylistic.configs["all-flat"].plugins, | ||
import: eslintPluginImport | ||
}, | ||
rules: { | ||
eqeqeq: "error", | ||
"import/order": "error", | ||
"import/extensions": [ | ||
"error", | ||
"ignorePackages", | ||
{ | ||
json: "always" // ignore json require (display EXT version and rev date) | ||
} | ||
], | ||
"import/newline-after-import": "error", | ||
"no-param-reassign": "error", | ||
"no-prototype-builtins": "off", | ||
"no-throw-literal": "error", | ||
"no-unused-vars": "off", | ||
"no-useless-return": "error", | ||
"object-shorthand": ["error", "methods"], | ||
"prefer-template": "error", | ||
"@stylistic/array-element-newline": ["error", "consistent"], | ||
"@stylistic/arrow-parens": ["error", "always"], | ||
"@stylistic/brace-style": "off", | ||
"@stylistic/comma-dangle": ["error", "never"], | ||
"@stylistic/dot-location": ["error", "property"], | ||
"@stylistic/function-call-argument-newline": ["error", "consistent"], | ||
"@stylistic/function-paren-newline": ["error", "consistent"], | ||
"@stylistic/implicit-arrow-linebreak": ["error", "beside"], | ||
"@stylistic/max-statements-per-line": ["error", { max: 2 }], | ||
"@stylistic/multiline-ternary": ["error", "always-multiline"], | ||
"@stylistic/newline-per-chained-call": ["error", { ignoreChainWithDepth: 4 }], | ||
"@stylistic/no-extra-parens": "off", | ||
"@stylistic/no-tabs": "off", | ||
"@stylistic/object-curly-spacing": ["error", "always"], | ||
"@stylistic/object-property-newline": ["error", { allowAllPropertiesOnSameLine: true }], | ||
"@stylistic/operator-linebreak": ["error", "before"], | ||
"@stylistic/padded-blocks": "off", | ||
"@stylistic/quote-props": ["error", "as-needed"], | ||
"@stylistic/quotes": ["error", "double"], | ||
"@stylistic/indent": ["error", 2], // indent 2 spaces | ||
"@stylistic/semi": ["error", "always"], | ||
"@stylistic/space-before-function-paren": ["error", "always"], | ||
"@stylistic/spaced-comment": "off" | ||
} | ||
} | ||
]; | ||
|
||
/* | ||
* Set debug to true for testing purposes. | ||
* Since some plugins have not yet been optimized for the flat config, | ||
* we will be able to optimize this file in the future. It can be helpful | ||
* to write the ESLint config to a file and compare it after changes. | ||
*/ | ||
const debug = false; | ||
|
||
if (debug === true) { | ||
const FileSystem = require("fs"); | ||
FileSystem.writeFile("eslint-config-DEBUG.json", JSON.stringify(config, null, 2), (error) => { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
} | ||
|
||
module.exports = config; |
Oops, something went wrong.