The Wayback Machine - https://web.archive.org/web/20220402211059/https://github.com/BrainJS/brain.js/commit/e575f106d91e5f80f1d8af91456da70cf3337046
Skip to content
Permalink
Browse files
fix imports in examples, improve eslint config
  • Loading branch information
mubaidr committed Sep 4, 2020
1 parent 6a5c625 commit e575f106d91e5f80f1d8af91456da70cf3337046
@@ -23,7 +23,4 @@ test/e2e/*.js
**.min.js
dist/
__coverage__/
rollup.config.js
rollup.config.browser.js

index.d.ts
@@ -4,41 +4,6 @@
"jest": true,
"node": true
},
"extends": [
"eslint:recommended",
"standard-with-typescript",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": ["prettier", "@typescript-eslint", "jest"],
"root": true,
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/member-delimiter-style": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/semi": "off",
"@typescript-eslint/space-before-function-paren": "off",
"arrow-parens": "off",
"class-methods-use-this": "off",
"max-classes-per-file": "off",
"standard/no-callback-literal": "off",
"no-continue": "off",
"no-empty-function": "off",
"no-multi-assign": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-prototype-builtins": "off",
"no-restricted-globals": "off",
"no-underscore-dangle": "off",
"prettier/prettier": "error",
"semi": "off"
}
"extends": "../.eslintrc.json",
"plugins": ["prettier", "@typescript-eslint", "jest"]
}
@@ -0,0 +1,11 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": "../.eslintrc.json",
"parserOptions": {
"project": "./tsconfig.json"
}
}
@@ -1,4 +1,4 @@
const brain = require('../../src');
const brain = require('../../dist/brain');

const trainingData = [
'Jane saw Doug.',
@@ -1,5 +1,5 @@
const assert = require('assert');
const brain = require('../../src');
const brain = require('../../dist/brain');

const trainingData = [
// xor data, repeating to simulate that we have a lot of data
@@ -1,4 +1,4 @@
const brain = require('../../src');
const brain = require('../../dist/brain');
const net = new brain.NeuralNetworkGPU();

const xorTrainingData = [
@@ -1,6 +1,6 @@
<html>
<head>
<script src="../../dist/brain-browser.js"></script>
<script src="https://unpkg.com/brain.js"></script>
<script>
const net = new brain.NeuralNetworkGPU();

@@ -1,4 +1,4 @@
const brain = require('../../src');
const brain = require('../../dist/brain');

const LSTM = brain.recurrent.LSTM;
const net = new LSTM();
@@ -1,5 +1,5 @@
const assert = require('assert');
const brain = require('../../src');
const brain = require('../../dist/brain');

const net = new brain.recurrent.LSTMTimeStep({
inputSize: 2,
@@ -1,4 +1,4 @@
const brain = require('brain.js');
const brain = require('../../dist/brain');

// create configuration for training
const config = {
@@ -25,7 +25,7 @@
</head>

<body onLoad="nextTry();">
<script src="../../../dist/brain-browser.min.js"></script>
<script src="https://unpkg.com/brain.js"></script>
<script src="itemsInStock.js"></script>
<script>
const color_normalization_factor = 100;
@@ -77,7 +77,7 @@
padding-left: 100px;
}
</style>
<script src="../../dist/brain-browser.js"></script>
<script src="https://unpkg.com/brain.js"></script>
</head>
<body>
<div class="flex-container">
@@ -86,16 +86,16 @@
<div class="input-wrapper">
<div class="input-label">Network type</div>
<select name="network-type">
<option value="NeuralNetwork"
>FeedForward (brain.NeuralNetwork)</option
>
<option value="NeuralNetwork">
FeedForward (brain.NeuralNetwork)
</option>
<option value="RNN">Recurrent (brain.recurrent.RNN)</option>
<option value="RNNTimeStep"
>Recurrent Time Step (brain.recurrent.RNNTimeStep)</option
>
<option value="FeedForward"
>FeedForward (brain.FeedForward)</option
>
<option value="RNNTimeStep">
Recurrent Time Step (brain.recurrent.RNNTimeStep)
</option>
<option value="FeedForward">
FeedForward (brain.FeedForward)
</option>
<option value="Recurrent">Recurrent (brain.Recurrent)</option>
</select>
</div>
@@ -208,7 +208,9 @@
name="inp-labels"
cols="23"
placeholder="inputs' labels separated by commas"
>a,b,c,d,e,f,g,h,i,j</textarea>
>
a,b,c,d,e,f,g,h,i,j</textarea
>
</div>
<div class="input-wrapper">
<label class="input-label"
@@ -1,5 +1,5 @@
const assert = require('assert');
const brain = require('../../src');
const brain = require('../../dist/brain');

const net = new brain.NeuralNetwork();
const xor = [
@@ -1,4 +1,4 @@
const brain = require('../../src');
const brain = require('../../dist/brain');

// create configuration for training
const config = {
@@ -1,5 +1,5 @@
const assert = require('assert');
const brain = require('../../src');
const brain = require('../../dist/brain');

/**
* Return 0 or 1 for '#'
@@ -112,7 +112,7 @@
"dist": "npm run build",
"lint": "run-p lint:**",
"lint:eslint": "eslint --fix --ext .js,.ts __tests__ src",
"lint:typecheck": "tsc",
"lint:typecheck": "tsc --project tsconfig.source.json",
"postinstall": "npm rebuild gpu.js",
"test": "jest",
"watch": "run-p watch:**",
@@ -13,7 +13,7 @@ export default {

// Specify here external modules which you don't want to include in your bundle (for instance: 'lodash', 'moment' etc.)
// https://rollupjs.org/guide/en#external-e-external
// external: ['gpu.js'],
external: [],

plugins: [
// Allows node_modules resolution
@@ -23,13 +23,13 @@ export default {
extensions,
}),

// Allow bundling cjs modules. Rollup doesn't understand cjs
commonjs(),

// Allows the node builtins to be required/imported.
globals(),
builtins(),

// Allow bundling cjs modules. Rollup doesn't understand cjs
commonjs(),

// Compile TypeScript/JavaScript files
babel({
extensions,
@@ -22,13 +22,13 @@ export default {
extensions,
}),

// Allow bundling cjs modules. Rollup doesn't understand cjs
commonjs(),

// Allows the node builtins to be required/imported.
globals(),
builtins(),

// Allow bundling cjs modules. Rollup doesn't understand cjs
commonjs(),

// Compile TypeScript/JavaScript files
babel({
extensions,
@@ -4,7 +4,6 @@
"allowSyntheticDefaultImports": true,
"checkJs": false,
"esModuleInterop": true,
"incremental": true,
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
@@ -15,6 +14,5 @@
"strict": true,
"target": "esnext"
},
"exclude": ["node_modules", "**/*.json", "**/*.config.js", "**/*.d.ts"],
"include": ["./src", "./__tests__"]
"exclude": ["node_modules", "**/*.json", "**/*.d.ts", "./dist"]
}
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"checkJs": false,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noEmitOnError": true,
"outDir": "./dist",
"rootDir": "./",
"skipLibCheck": true,
"strict": true,
"target": "esnext"
},
"exclude": ["node_modules", "**/*.json", "**/*.d.ts", "./dist"],
"include": ["./src"]
}

0 comments on commit e575f10

Please sign in to comment.