-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8827 from meshery/feat/setup-prettier
[UI] feat: Setup prettier and moved lint-staged to its own file
- Loading branch information
Showing
330 changed files
with
22,653 additions
and
19,981 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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
{ | ||
"presets": ["next/babel"], | ||
"plugins": [ | ||
"relay", | ||
[ | ||
"istanbul", | ||
{ | ||
"exclude": [ | ||
"**/*.spec.js", | ||
"pages/_document.js" | ||
] | ||
} | ||
] | ||
"presets": [ | ||
"next/babel" | ||
], | ||
"plugins": [ | ||
"relay", | ||
[ | ||
"istanbul", | ||
{ | ||
"exclude": [ | ||
"**/*.spec.js", | ||
"pages/_document.js" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -7,4 +7,4 @@ package-lock.json | |
nodemon.json | ||
lib/ | ||
cypress/ | ||
pages/_document.js | ||
**/__generated__/** |
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,99 +1,60 @@ | ||
module.exports = { | ||
env : { | ||
browser : true, | ||
es6 : true, | ||
node : true, // tells the parser that we are using nodejs | ||
env: { | ||
browser: true, | ||
es6: true, | ||
node: true, // tells the parser that we are using nodejs | ||
}, | ||
|
||
settings : { | ||
react : { | ||
version : require("./package.json").dependencies.react, | ||
settings: { | ||
react: { | ||
version: require('./package.json').dependencies.react, | ||
}, | ||
}, | ||
extends : ["eslint:recommended", "plugin:react/recommended", "plugin:cypress/recommended", "next"], | ||
globals : { | ||
Atomics : "readonly", | ||
SharedArrayBuffer : "readonly", | ||
globalThis : "readonly", | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:cypress/recommended', | ||
'next', | ||
'plugin:prettier/recommended', | ||
], | ||
globals: { | ||
Atomics: 'readonly', | ||
SharedArrayBuffer: 'readonly', | ||
globalThis: 'readonly', | ||
}, | ||
parser : "@babel/eslint-parser", | ||
parserOptions : { | ||
ecmaFeatures : { | ||
jsx : true, | ||
parser: '@babel/eslint-parser', | ||
parserOptions: { | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
ecmaVersion : 2018, | ||
sourceType : "module", | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
}, | ||
plugins : ["react", "cypress"], | ||
rules : { | ||
"@next/next/no-img-element" : "off", | ||
// turn off next img/image warning | ||
"react-hooks/rules-of-hooks" : "warn", | ||
// warn about react-hooks | ||
"react-hooks/exhaustive-deps" : "off", | ||
// turn off react-hooks exhaustive-deps for now | ||
"jsx-a11y/alt-text" : "off", | ||
// turn off image alt text warning | ||
"valid-typeof" : "warn", | ||
// show warning for now | ||
"array-bracket-spacing" : ["error", "never"], | ||
"comma-style" : ["error"], | ||
"jsx-quotes" : ["error", "prefer-double"], | ||
"block-scoped-var" : "error", | ||
"keyword-spacing" : "error", | ||
"no-trailing-spaces" : "error", | ||
"object-curly-spacing" : ["error", "always"], | ||
"arrow-spacing" : [ | ||
"error", | ||
{ | ||
before : true, | ||
after : true, | ||
}, | ||
], | ||
"key-spacing" : [ | ||
"error", | ||
{ | ||
afterColon : true, | ||
beforeColon : true | ||
}, | ||
], | ||
"block-spacing" : "error", | ||
"brace-style" : ["error", "1tbs"], | ||
indent : [ | ||
"error", | ||
2, | ||
{ | ||
FunctionExpression : { | ||
parameters : "first", | ||
}, | ||
FunctionDeclaration : { | ||
parameters : "first", | ||
}, | ||
MemberExpression : 1, | ||
SwitchCase : 1, | ||
outerIIFEBody : 0, | ||
VariableDeclarator : { | ||
var : 2, | ||
let : 2, | ||
const : 3, | ||
}, | ||
ignoredNodes : ["TemplateLiteral"], | ||
}, | ||
], | ||
"react/react-in-jsx-scope" : "off", | ||
"no-undef" : "error", | ||
"react/jsx-uses-vars" : [2], | ||
"react/jsx-no-undef" : "error", | ||
"no-console" : 0, | ||
"no-unused-vars" : "error", | ||
"react/jsx-key" : "warn", | ||
"no-dupe-keys" : "error", | ||
"react/jsx-filename-extension" : [ | ||
plugins: ['react', 'cypress', 'prettier'], | ||
rules: { | ||
'@next/next/no-img-element': 'off', | ||
'react-hooks/rules-of-hooks': 'warn', | ||
'react-hooks/exhaustive-deps': 'off', | ||
'jsx-a11y/alt-text': 'off', | ||
'valid-typeof': 'warn', | ||
'no-trailing-spaces': 'error', | ||
'block-spacing': 'error', | ||
'brace-style': ['error', '1tbs'], | ||
'react/react-in-jsx-scope': 'off', | ||
'no-undef': 'error', | ||
'react/jsx-uses-vars': [2], | ||
'react/jsx-no-undef': 'error', | ||
'no-console': 0, | ||
'no-unused-vars': 'error', | ||
'react/jsx-key': 'warn', | ||
'no-dupe-keys': 'error', | ||
'react/jsx-filename-extension': [ | ||
1, | ||
{ | ||
extensions : [".js", ".jsx"], | ||
extensions: ['.js', '.jsx'], | ||
}, | ||
], | ||
"react/prop-types" : "off", | ||
'react/prop-types': 'off', | ||
'prettier/prettier': 'warn', | ||
}, | ||
}; | ||
}; |
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 @@ | ||
module.exports = { | ||
// Lint & Prettify TS and JS files | ||
'**/*.(ts|tsx|js|jsx)': (filenames) => [`npm run lint:fix`, `npm run format`], | ||
|
||
// Prettify only Markdown and JSON files | ||
'**/*.(md|json)': (filenames) => `npx prettier --write ${filenames.join(' ')}`, | ||
}; |
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,14 @@ | ||
*.svg | ||
*.ico | ||
*.css | ||
|
||
*/.DS_Store | ||
assets/** | ||
.next | ||
package-lock.json | ||
public | ||
node_modules | ||
next-env.d.ts | ||
next.config.js | ||
.eslintrc.js | ||
**/__generated__/** |
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,12 @@ | ||
arrowParens: always | ||
bracketSameLine: false | ||
bracketSpacing: true | ||
jsxSingleQuote: false | ||
proseWrap: preserve | ||
quoteProps: as-needed | ||
semi: true | ||
singleQuote: true | ||
tabWidth: 2 | ||
trailingComma: all | ||
printWidth: 100 | ||
useTabs: 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,5 +1,5 @@ | ||
import { promisifiedDataFetch } from "../lib/data-fetch"; | ||
import { promisifiedDataFetch } from '../lib/data-fetch'; | ||
|
||
export const getConnectionStatusSummary = async () => { | ||
return await promisifiedDataFetch("/api/integrations/connections/status"); | ||
return await promisifiedDataFetch('/api/integrations/connections/status'); | ||
}; |
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,16 +1,15 @@ | ||
import axios from "axios"; | ||
import axios from 'axios'; | ||
|
||
const instance = axios.create({ | ||
withCredentials : true // for pushing client-cookies in all requests to server | ||
withCredentials: true, // for pushing client-cookies in all requests to server | ||
}); | ||
|
||
instance.interceptors.response.use(response => { | ||
if (response.request.responseURL.includes("/auth/login")) { | ||
window.location = "/auth/login"; | ||
instance.interceptors.response.use((response) => { | ||
if (response.request.responseURL.includes('/auth/login')) { | ||
window.location = '/auth/login'; | ||
window.onbeforeunload = null; | ||
} | ||
return response; | ||
}); | ||
|
||
|
||
export default instance; | ||
export default instance; |
Oops, something went wrong.