add editorconfig, reformat all

This commit is contained in:
Tykayn 2023-09-10 11:30:50 +02:00 committed by tykayn
parent e88493c58e
commit 1783ce4fba
19 changed files with 699 additions and 681 deletions

40
.editorconfig Executable file
View File

@ -0,0 +1,40 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
# Spaces in coffee
[**.coffee]
indent_style = tab
indent_size = 2
[**.js]
indent_style = tab
indent_size = 2
[**.ts]
indent_style = tab
indent_size = 2
# Tabs in less
[**.less]
indent_style = tab
indent_size = 2
[**.css]
indent_style = tab
indent_size = 2
[**.php]
indent_style = tab
indent_size = 2
[**.html]
indent_style = tab
indent_size = 2

View File

@ -1,12 +1,12 @@
const presets = [
[
"@babel/preset-env",
'@babel/preset-env',
{
targets: {
node: 'current'
}
}
]
];
]
module.exports = { presets };
module.exports = { presets }

View File

@ -1,10 +1,12 @@
import constants from './folders'
interface fileDetectionTemplate {
'example': string,
'pattern': any,
'auto_tag'?: string,
'auto_sort_folder'?: string
}
interface AssemblyOfFileDetection {
downloaded_pic: fileDetectionTemplate,
telegram_pic: fileDetectionTemplate,

View File

@ -3,6 +3,7 @@
*/
import config_rangement from './conf/configs.js'
let my_conf = new config_rangement({})
console.log('config', my_conf.version)

View File

@ -6,10 +6,7 @@
/** ---------------------
libs
--------------------- */
import fs from 'node-fs'
import minimist from 'minimist'
import log from 'loglevel'
import * as path from 'node:path'
/** ---------------------
custom utilities and configuration
--------------------- */
@ -21,7 +18,6 @@ log.setLevel(rangement_instance.log_level)
log.info(' ')
finder.parseArguments()
finder.guessFileNameOnAllFilesFromArguments()

View File

@ -6,10 +6,7 @@
/** ---------------------
libs
--------------------- */
import fs from 'node-fs'
import minimist from 'minimist'
import log from 'loglevel'
import path from 'node:path'
/** ---------------------
custom utilities and configuration
--------------------- */
@ -21,9 +18,6 @@ let mini_arguments
log.setLevel(rangement_instance.log_level)
log.info(' ')
finder.parseArguments()
finder.guessFileNameOnAllFilesFromArguments()

View File

@ -44,8 +44,6 @@ describe('detection in file name', () => {
describe('modification in file name', () => {
test('should append to file name in the right place', () => {
let fileNameOriginal = 'mon texte -- famille vacances plage.jpg'
let properties = finder.destructurateFileName(fileNameOriginal)

View File

@ -1,15 +1,12 @@
import finder from "../utils/finder.ts";
import { Jest as mockUpload } from '@jest/environment'
xdescribe('rangement file detection', () => {
// find how to mock process.env arguments
// const call = mockUpload.mock.calls[0][0]
test('returns a list of 2 files to parse when given the folder testFiles/meme_base', () => {
});
test('returns a list of 1 file to parse when given the argument testFiles/image.jpg', () => {
});
test('returns a list of 0 file to parse when given the null argument', () => {
});
})
test('returns a list of 1 file to parse when given the argument testFiles/image.jpg', () => {
})
test('returns a list of 0 file to parse when given the null argument', () => {
})
})

View File

@ -1,4 +1,3 @@
xdescribe('detection and tagging with content found in PDF content', () => {
xtest('should find invoice hint in pdf', () => {

View File

@ -1,4 +1,3 @@
xdescribe('detection and renaming of templated file names', () => {
xtest('should detect screenshot pattern', () => {

View File

@ -1,15 +1,12 @@
{
// This is an alias to @tsconfig/node16: https://github.com/tsconfig/bases
"extends": "ts-node/node16/tsconfig.json",
// Most ts-node options can be specified here using their programmatic names.
"ts-node": {
// It is faster to skip typechecking.
// Remove if you want ts-node to do typechecking.
"transpileOnly": true,
"files": true,
"compilerOptions": {
// compilerOptions specified here will override those declared below,
// but *only* in ts-node. Useful if you want ts-node and tsc to use
@ -18,5 +15,6 @@
},
"compilerOptions": {
// typescript options here
"allowSyntheticDefaultImports": true
}
}

View File

@ -185,7 +185,8 @@ export default class finder {
if (rangement_instance.reportStatistics || this.mini_arguments.stats) {
finder.reportStatistics()
} }
}
}
static makeFileNameFromProperties(fileProperties: fileDestructuration) {

View File

@ -1,6 +1,5 @@
import finder from './finder.js'
const pathFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher/tout'
const sortingFolder = '/home/poule/encrypted/stockage-syncable/photos/a_dispatcher'
@ -35,7 +34,6 @@ export function TestTagsAreDetectedInFileName() {
}
}
export function TestFindFormattedDate () {
let mockFileName = 'Capture d\'écran 2023-06-15T10:11:12.png'
let expectedResult = '2023-06-15T10:11:12'

View File

@ -134,7 +134,6 @@ class notReadyFunctions {
}
// run tests
if (rangement_instance.enableTestsLocally) {
@ -143,7 +142,4 @@ if (rangement_instance.enableTestsLocally) {
TestScreenShotIsFoundAndRenamed()
}
export default notReadyFunctions

View File

@ -2,21 +2,20 @@
création de la config
*/
// import i18next from 'i18next'
import config_rangement from "../../conf/configs.js";
import config_rangement from '../../conf/configs.js'
const { stdin, stdout } = process;
const { stdin, stdout } = process
function prompt (question) {
return new Promise((resolve, reject) => {
stdin.resume();
stdout.write(question);
stdin.resume()
stdout.write(question)
stdin.on('data', data => resolve(data.toString().trim()));
stdin.on('error', err => reject(err));
});
stdin.on('data', data => resolve(data.toString().trim()))
stdin.on('error', err => reject(err))
})
}
async function main () {
try {
// const name = await prompt(i18next.t("home.title"))
@ -24,15 +23,15 @@ async function main() {
// const age = await prompt("What's your age? ");
// const email = await prompt("What's your email address? ");
// const user = { name, age, email };
console.log('le dossier de base des archives est : ',name);
console.log('le dossier de base des archives est : ', name)
stdin.pause();
stdin.pause()
} catch (error) {
console.log("There's an error!");
console.log(error);
console.log('There\'s an error!')
console.log(error)
}
process.exit();
process.exit()
}
main();
main()