/
home
/
techb158
/
balavpn.abdallabala.com
/
node_modules
/
@next
/
eslint-plugin-next
/
dist
/
rules
/
/home/techb158/balavpn.abdallabala.com/node_modules/@next/eslint-plugin-next/dist/rules
mkdir
upload
Name
Size
Mode
Actions
google-font-display.d.ts
77
0666
edit
dl
rm
google-font-display.js
2117
0666
edit
dl
rm
google-font-preconnect.d.ts
77
0666
edit
dl
rm
google-font-preconnect.js
1596
0666
edit
dl
rm
inline-script-id.d.ts
77
0666
edit
dl
rm
inline-script-id.js
2800
0666
edit
dl
rm
next-script-for-ga.d.ts
77
0666
edit
dl
rm
next-script-for-ga.js
3004
0666
edit
dl
rm
no-assign-module-variable.d.ts
77
0666
edit
dl
rm
no-assign-module-variable.js
1259
0666
edit
dl
rm
no-async-client-component.d.ts
77
0666
edit
dl
rm
no-async-client-component.js
5489
0666
edit
dl
rm
no-before-interactive-script-outside-document.d.ts
77
0666
edit
dl
rm
no-before-interactive-script-outside-document.js
3636
0666
edit
dl
rm
no-css-tags.d.ts
77
0666
edit
dl
rm
no-css-tags.js
1421
0666
edit
dl
rm
no-document-import-in-page.d.ts
77
0666
edit
dl
rm
no-document-import-in-page.js
2665
0666
edit
dl
rm
no-duplicate-head.d.ts
77
0666
edit
dl
rm
no-duplicate-head.js
2513
0666
edit
dl
rm
no-head-element.d.ts
77
0666
edit
dl
rm
no-head-element.js
1202
0666
edit
dl
rm
no-head-import-in-document.d.ts
77
0666
edit
dl
rm
no-head-import-in-document.js
2751
0666
edit
dl
rm
no-html-link-for-pages.d.ts
77
0666
edit
dl
rm
no-html-link-for-pages.js
9362
0666
edit
dl
rm
no-img-element.d.ts
77
0666
edit
dl
rm
no-img-element.js
2363
0666
edit
dl
rm
no-page-custom-font.d.ts
77
0666
edit
dl
rm
no-page-custom-font.js
6372
0666
edit
dl
rm
no-script-component-in-head.d.ts
77
0666
edit
dl
rm
no-script-component-in-head.js
1663
0666
edit
dl
rm
no-styled-jsx-in-document.d.ts
77
0666
edit
dl
rm
no-styled-jsx-in-document.js
2836
0666
edit
dl
rm
no-sync-scripts.d.ts
77
0666
edit
dl
rm
no-sync-scripts.js
1298
0666
edit
dl
rm
no-title-in-document-head.d.ts
77
0666
edit
dl
rm
no-title-in-document-head.js
1919
0666
edit
dl
rm
no-typos.d.ts
77
0666
edit
dl
rm
no-typos.js
4960
0666
edit
dl
rm
no-unwanted-polyfillio.d.ts
77
0666
edit
dl
rm
no-unwanted-polyfillio.js
4406
0666
edit
dl
rm
Edit:
/home/techb158/balavpn.abdallabala.com/node_modules/@next/eslint-plugin-next/dist/rules/no-typos.js
(4960B)
"use strict"; var _definerule = require("../utils/define-rule"); var _path = /*#__PURE__*/ _interop_require_wildcard(require("path")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interop_require_wildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = { __proto__: null }; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for(var key in obj){ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } var NEXT_EXPORT_FUNCTIONS = [ 'getStaticProps', 'getStaticPaths', 'getServerSideProps' ]; // 0 is the exact match var THRESHOLD = 1; // the minimum number of operations required to convert string a to string b. function minDistance(a, b) { var m = a.length; var n = b.length; if (m < n) { return minDistance(b, a); } if (n === 0) { return m; } var previousRow = Array.from({ length: n + 1 }, function(_, i) { return i; }); for(var i = 0; i < m; i++){ var s1 = a[i]; var currentRow = [ i + 1 ]; for(var j = 0; j < n; j++){ var s2 = b[j]; var insertions = previousRow[j + 1] + 1; var deletions = currentRow[j] + 1; var substitutions = previousRow[j] + Number(s1 !== s2); currentRow.push(Math.min(insertions, deletions, substitutions)); } previousRow = currentRow; } return previousRow[previousRow.length - 1]; } module.exports = (0, _definerule.defineRule)({ meta: { docs: { description: 'Prevent common typos in Next.js data fetching functions.', recommended: true }, type: 'problem', schema: [] }, create: function create(context) { function checkTypos(node, name) { if (NEXT_EXPORT_FUNCTIONS.includes(name)) { return; } var potentialTypos = NEXT_EXPORT_FUNCTIONS.map(function(o) { return { option: o, distance: minDistance(o, name) }; }).filter(function(param) { var distance = param.distance; return distance <= THRESHOLD && distance > 0; }).sort(function(a, b) { return a.distance - b.distance; }); if (potentialTypos.length) { context.report({ node: node, message: "".concat(name, " may be a typo. Did you mean ").concat(potentialTypos[0].option, "?") }); } } return { ExportNamedDeclaration: function ExportNamedDeclaration(node) { var page = context.filename.split('pages', 2)[1]; if (!page || _path.parse(page).dir.startsWith('/api')) { return; } var decl = node.declaration; if (!decl) { return; } switch(decl.type){ case 'FunctionDeclaration': { checkTypos(node, decl.id.name); break; } case 'VariableDeclaration': { decl.declarations.forEach(function(d) { if (d.id.type !== 'Identifier') { return; } checkTypos(node, d.id.name); }); break; } case 'ClassDeclaration': break; default: decl; } return; } }; } });
Save
cmd:
run